Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder
    Join Date
    Aug 2002
    Location
    Oregon, United States of America
    Posts
    882
    Thanks
    1
    Thanked 9 Times in 9 Posts

    mod rewrite question

    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?
    If I'm postin here, I NEED YOUR HELP!!

  • #2
    Regular Coder
    Join Date
    Feb 2008
    Location
    Australia baby!
    Posts
    143
    Thanks
    6
    Thanked 3 Times in 3 Posts
    .htaccess:
    Code:
    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
    Last edited by outseeker; 02-21-2008 at 11:47 AM. Reason: Added options 4 ya
    outseeker - http://outer.reaches.dyndns.org/index.php
    I hope this helped someone. Due to this forums lame rep system penalising me for nothing, and admins inability to do anything about it, I'm sorry to say I will no longer be online here. Pride is important. Good Luck All.

  • #3
    Regular Coder
    Join Date
    Aug 2002
    Location
    Oregon, United States of America
    Posts
    882
    Thanks
    1
    Thanked 9 Times in 9 Posts
    Thanks for the explanation along with it. I wish people would do that when I request regex help.
    If I'm postin here, I NEED YOUR HELP!!

  • #4
    Regular Coder
    Join Date
    Feb 2008
    Location
    Australia baby!
    Posts
    143
    Thanks
    6
    Thanked 3 Times in 3 Posts
    No problem champ. Did it do the trick? If it did, click my can you? I'm down to -1: Almost back to 0 rep!
    outseeker - http://outer.reaches.dyndns.org/index.php
    I hope this helped someone. Due to this forums lame rep system penalising me for nothing, and admins inability to do anything about it, I'm sorry to say I will no longer be online here. Pride is important. Good Luck All.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •