Adding mod-rewrite to an existing PHP website

LostVB

New Member
I am updating a php app, which currently does not use url rewriting. The aim is to hide file extensions. The general structure of the website is as follows\[code\]root/ index.php login.php page1.php page2.php page3.php page4.php page5.php page6.php page7.php page8.phpsubfolder/ index.php validpage.phpimages/css/\[/code\]The subfolder folder in the above structure is unique in that it is the only subfolder containing php files.All of the other files are in the root folder.I have been through these questions http://stackoverflow.com/questions/788188/mod-rewrite-and-php and http://stackoverflow.com/questions/1868154/mod-rewrite-or-php-router and http://stackoverflow.com/questions/265898/mod-rewrite-php-and-the-htaccess-file Updated htaccess. thanks to @thomasmalt\[code\]RewriteEngine onRewriteBase /RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -f [OR]RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -d [OR]RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -l RewriteRule ^.*$ - [NC,L]# only rewrite if the requested file doesn't existRewriteCond %{REQUEST_FILENAME} !-s # add .php to the url RewriteRule ^(.*)$ $1.php\[/code\]Problem now is I get a 500 instead of a 404 error, when I try to access a non existent page like localhost/inex.php. The Apache error log gives me the following errors. (I accessed localhost/index which loaded the contents of index.php , followed by which I loaded localhost/inex which gave me a 500 error.)\[code\][Sat Sep 25 14:44:26 2010] [error] [client 127.0.0.1] File does not exist: C:/wamp/www/index[Sat Sep 25 14:44:36 2010] [error] [client 127.0.0.1] Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.\[/code\]Update: found the answer to my question here. The question is resolved.
 
Back
Top