1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Need a hand with mod_rewrite

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

  1. Duncan

    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

    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