...

mod rewrite question

Ultragames
02-21-2008, 12:09 AM
I need to direct any file request to ajax.mypage.php to ajax/mypage.php, where mypage.php can be anything. How can I do this?

outseeker
02-21-2008, 10:45 AM
.htaccess:
RewriteEngine on
RewriteBase /
RewriteRule ^ajax\.(.*).php$ ajax/$1.php [NC,R=301]

Any request to yourwebsite.com/ajax.whatever.php will change to yourwebsite.com/ajax/whatever.php ok? :)

If u want their browser to show the original ajax.whatever.php u can remove the R=301 which is telling the browser to change it's address. Also the NC is for Not Caps sensitive, I assume u would want that. If u wanna rewrite everything (not just .php) remove the .php twice is all u gotta do :)

Ultragames
02-21-2008, 10:16 PM
Thanks for the explanation along with it. I wish people would do that when I request regex help.

outseeker
02-22-2008, 01:46 AM
No problem champ. Did it do the trick? :) If it did, click my http://www.codingforums.com/images/buttons/reputation.gif can you? I'm down to -1: Almost back to 0 rep! :D



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum