Results 1 to 5 of 5

Thread: mod_rewrite ?

  1. #1
    4x4
    Join Date
    Oct 2004
    Posts
    1,043

    mod_rewrite ?

    I have:
    RewriteRule ^large.php http://www.mysite.com/ [L,R=301]

    It works.
    But if it looks like large.php?something=blah it won't 301.

    I tried ^large.php$ and it didn't work. also Tried ^large.php.*$

    Anyone have any ideas?

    -Todd

  2. #2
    Site Contributor KLB's Avatar
    Join Date
    Feb 2006
    Location
    Saco Maine
    Posts
    1,181
    Quote Originally Posted by ToddW View Post
    I have:
    RewriteRule ^large.php http://www.mysite.com/ [L,R=301]

    It works.
    But if it looks like large.php?something=blah it won't 301.

    I tried ^large.php$ and it didn't work. also Tried ^large.php.*$

    Anyone have any ideas?

    -Todd
    It should read:
    RewriteRule ^large.php http://www.mysite.com/ [R=301,QSA,L]
    Ken Barbalace - EnvironmentalChemistry.com (Environmental Careers, Blog)
    InternetSAR.org: Volunteers Assisting Search and Rescue via the Internet
    My Firefox Theme Classic Compact: Based onFirefox's classic theme but uses much less window space

  3. #3
    4x4
    Join Date
    Oct 2004
    Posts
    1,043
    Quote Originally Posted by KLB View Post
    It should read:
    RewriteRule ^large.php http://www.mysite.com/ [R=301,QSA,L]
    That doesn't work.

  4. #4
    Registered
    Join Date
    Aug 2006
    Location
    Sacramento, CA
    Posts
    208
    What you have should work. Are there any other rules that might be messing it up?
    ________
    TOYOTA PZ ENGINE SPECIFICATIONS
    Last edited by rpanella; 03-17-2011 at 11:03 AM.

  5. #5
    Site Contributor KLB's Avatar
    Join Date
    Feb 2006
    Location
    Saco Maine
    Posts
    1,181
    Do you have the following instruction in your .htaccess file?

    RewriteEngine on

    The QSA is required to append any querystrings to a request.

    Here are some real rewrite instructions I use in my .htaccess file:
    Code:
    RewriteRule ^(actinium|ACTINIUM|Actinium)(.*) /yogi/periodic/Ac.html [R=301,L]
    RewriteRule ^blog/(.*)?$ http://blog.environmentalchemistry.com/$1 [R=301,QSA,L]
    RewriteRule ^links/srad(.[0-9]+)mrurl/bak/(.*) http://banners.aftrk.com/$2 [R=301,QSA,L]
    Ken Barbalace - EnvironmentalChemistry.com (Environmental Careers, Blog)
    InternetSAR.org: Volunteers Assisting Search and Rescue via the Internet
    My Firefox Theme Classic Compact: Based onFirefox's classic theme but uses much less window space

Bookmarks

Posting Permissions

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