Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9087985
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T21:49:19+00:00 2026-06-16T21:49:19+00:00

Consider this workflow: User makes a request to website.com/lolmyblogpost My .htacces is all like…

  • 0

Consider this workflow:

User makes a request to website.com/lolmyblogpost

My .htacces is all like…

RewriteCond %{REQUEST_URI} !=/index.php
RewriteRule .* /index.php

Where in index.php im going to search a file tree of templates for lolmyblogpost.html returning:

/path/to/lolmyblogpost.html

So in my master template I can:

{include file="{$pathToTemplate}"}

How do I search a directory tree for a file and return the file path?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T21:49:21+00:00Added an answer on June 16, 2026 at 9:49 pm

    What you really want is “look back” support with a default type. Set up your Apache virtual host (something) like this:

    <VirtualHost *:80>
        ServerName  example.com:80
        ServerAlias www.example.com
        DocumentRoot    "/path/to/root/dir"
        AddDefaultCharset UTF-8
        ErrorDocument 403 "/403.php"
        ErrorDocument 404 "/404.php"
        <Directory /path/to/root/dir>
                Options Indexes FollowSymLinks
                DefaultType application/x-httpd-php
                AllowOverride All
                Order deny,allow
                Allow from all
                AddOutputFilterByType DEFLATE application/javascript text/css text/html text/plain text/xml
                RewriteEngine On
                RewriteBase /
                RewriteCond %{REQUEST_FILENAME} !.index.ph.*
                RewriteRule ^(.*)$  /index.php
        </Directory>
    </VirtualHost>
    

    The important line is DefaultType application/x-httpd-php, which means you can now get rid of the .php file extension.

    You can now use a URL like http://example.com/this_is_a_php_page and you can also use http://example.com/this_is_a_php_page/with_a_path_info_var.

    So, on this_is_a_php_page (which is really a .php file without an extension) you can use $_SERVER['PATH_INFO'] to check for and vars that are being passed in the URI.

    Edit:
    Added the RewriteEngine and rule to push everything to index.php. This means you now have a (real) single page on the server called index.php which will need to check the $_SERVER['REDIRECT_URL'] var for what was really requested.

    For example, a request for http://example.com/a_page will now load index.php with a_page passed to $_SERVER['REDIRECT_URL']. NOTE: this solution will push everything to index.php. You will need to include an exception like:

     RewriteCond %{REQUEST_FILENAME} !.not_me_plz.*
    

    To allow all files that start with not_me_plz files to be served “as expected”.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Consider this layout (pulled from here ): I'd like to understand the principles behind
Consider this code snippet that prompts the user to rate the app on the
Consider this folder structure in repository Root |----Plugins |----|-----Plugin1 |----Themes |-----|----Theme1 I have all
Consider this code: enum { ERR_START, ERR_CANNOTOPENFILE, ERR_CANNOTCONNECT, ERR_CANNOTCONNECTWITH, ERR_CANNOTGETHOSTNAME, ERR_CANNOTSEND, }; char* ERR_MESSAGE[]
Consider this contrived, trivial example: var foo = new byte[] {246, 127}; var bar
Consider this (rather pointless) javascript code: function make_closure() { var x = 123, y
Consider this simple model: A base Location table: +-------------------------------+ | Locations | +-------------------------------+ |(PK)
Consider this template function: template<typename ReturnT> ReturnT foo(const std::function<ReturnT ()>& fun) { return fun();
consider this simple function def foo(l=[]): if not l: print List is empty else
Consider this small program: #include <stdio.h> #include <stdlib.h> // Change 60000 to 70000 and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.