1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. In order to post messages and view attached files in this forum, you must be a licensed XenForo customer.
    If you can't post, enter your forum username in the Associated Forum Users form in your customer area.

Need a hand with mod_rewrite

Discussion in 'General PHP and MySQL Discussions' started by Duncan, Nov 20, 2011.

  1. Duncan Member

    I have folders on my website, www.example.com/folder/name/file.php which is the default address. However I want to have it rewritten to name.example.com/file.php so it looks a little cleaner in the url. I'm only assuming mod_rewrite is the proper way to do this, so any help would be greatly appreciated.
  2. Shamil Well-Known Member

    Is there a common theme, or example here, or do you just want www.example.com/folder/name/file.php -> name.example.com/file.php?

    I think it's something around

    Code:
    RewriteRule ^([0-9][0-9])$.example.com/([0-9][0-9])$.php www.example.com/folder/$1/$2.php
    Also, do you want it to be HTTP 301 or 302?

Share This Page