Wednesday 15 January 2014

apache - How do I create an .htaccess to serve index if the last node is a directory, else, serve a file? -


So, if I have the following URL:

the last node URL (In this case, drink) will be either a directory, in this situation I want to serve index.php, or this "PPPP" I would like to serve those files, in this situation I want to serve those files.

Definitely will serve index.fp.

"Beautiful URL" will appear with both the maintenance slash.

Is this possible? The site will consistently follow this format and I am mainly trying to avoid routing everyone through main index file.

Place this site in .htaccess under the root directory of your site

  Options- Multimedia Rev. Engage on Rev.% {REQUEST_FILENAME} -d Records-Rule (. +) / $ 1 / Indsf.PP [QSA, L] RevertCand% {DOCUMENT_ROOT} / $ 1.php -f Rewrite Rule ^ ( . +?) /? $ / $ 1 .php [QSA, L]    

No comments:

Post a Comment