Results 1 to 4 of 4
  1. #1

    A mod_rewrite htaccess Q?

    I'm moving a cms down one level.
    I was woundering If I could use mod rewrite to take all urls using the old part of the url and rewrite it to the new one.

    example:
    Old: www.example.com/main/dfgdfg/
    to
    New: www.example.com/bvgfgf/

    Thanks
    Shifty
    Edit:
    is it also possible to make all www. go to no www?

  2. #2
    Join Date
    May 2004
    Location
    Lansing, MI, USA
    Posts
    1,548
    well, for the first one...

    Code:
    RewriteRule ^main/(.*)$ $1 [L,R=301]
    should probably do the trick.

    For the domain one...
    Code:
    RewriteCond %{HTTP_HOST} ^www\.example\.com$
    RewriteRule (.*) http://example.com/$1
    should do it.
    Jacob - WebOnce Technologies - 30 Day 100% Satisfaction Guarantee - Over 5 Years Going Strong!
    Website Hosting, PHP4&5, RoR, MySQL 5.0, Reseller Hosting, Development, and Designs
    Powered By JAM - Professional Website Development - PHP, MySQL, JavaScript, AJAX - Projects Small & Large

  3. #3
    Quote Originally Posted by WO-Jacob
    well, for the first one...

    Code:
    RewriteRule ^main/(.*)$ $1 [L,R=301]
    should probably do the trick.

    For the domain one...
    Code:
    RewriteCond %{HTTP_HOST} ^www\.example\.com$
    RewriteRule (.*) http://example.com/$1
    should do it.
    when i do the 1st one main turns into:
    /home/stre/public_html/

  4. #4
    Join Date
    Apr 2003
    Location
    San Jose, CA.
    Posts
    1,622
    Unless you want to get rid of indexers keeping a reference to the main sub-directory...

    I'd just symlink main to .
    ln -s . main

    tho i wasnt sure if dfgdfg was supposed to be the same as bvgfgf... ?

Posting Permissions

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