Fowarding file extension

Need help installing PHP, configuring a script, or configuring a server? Then come on in and post your questions! We'll try to help the best we can!

Moderator: General Moderators

Post Reply
User avatar
tecktalkcm0391
DevNet Resident
Posts: 1030
Joined: Fri May 26, 2006 9:25 am
Location: Florida

Fowarding file extension

Post by tecktalkcm0391 »

[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:

Code: Select all

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*)\.do $1\.php [L]
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. :D
Post Reply