Fowarding file extension
Posted: Mon Jul 16, 2007 11:20 am
[s]Can someone show me how to do this for mod_rewrite. [/s](I still can't understand mod_rewrite
)
[s]A user goes to http://site.com/code.do
If code.do does not exist, open code.php, but shows code.do[/s]
Edited. I got this far with what I was asking to do...
if a user goes to site.com/code.do and there is not a file named code.do or a directory it will open code.php:
Now I want to make it so if a user goes to site.com/code.php it redirects them to site.com/code.do if there is no code.do existing already. Can you help me with this. 
[s]A user goes to http://site.com/code.do
If code.do does not exist, open code.php, but shows code.do[/s]
Edited. I got this far with what I was asking to do...
if a user goes to site.com/code.do and there is not a file named code.do or a directory it will open code.php:
Code: Select all
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*)\.do $1\.php [L]