Thread: Page redirects

Results 1 to 10 of 12

Hybrid View

  1. #1
    Join Date
    Sep 2009
    Posts
    16
    Plugin Contributions
    0

    Default Re: Page redirects

    Thanks for the reply, I actually used

    RewriteRule ^shop/(.*).html$ /$1 [R,L]

    (one less / than my original attempt) is there any advantage to using the one you have posted up?

  2. #2
    Join Date
    Sep 2009
    Posts
    16
    Plugin Contributions
    0

    Default Re: Page redirects

    I just discovered the answer myself! It wouldn't let me log into my admin for some reason. Used yours and it worked perfectly.

    Thanks for that!

  3. #3
    Join Date
    Mar 2010
    Location
    UK
    Posts
    445
    Plugin Contributions
    0

    Default Re: Page redirects

    Quote Originally Posted by celticwebsolutions View Post
    Is there any advantage to using the one you have posted up?
    There's three advantages:

    Your code generates a 302 redirect. That is not what you want. My code sends a 301 redirect.

    Your code uses the (.*) pattern which is "greedy and ambiguous". It matches "anything, everything or nothing". It likely requires hundreds of "back off and retry" attempts to find the correct match. My code can be parsed in a single left-to-right read operation. My code will parse a lot faster.

    Your code doesn't specify the target domain name, and therefore can lead to an unwanted multi-step redirection chain when URLs on the non-canonical domain are requested.

    The new code avoids all of those problems:
    Code:
    RewriteRule ^shop/(([^/]+/)*)([^/.]+)\.html$ http://www.example.com/$1$3 [R=301,L]

 

 

Similar Threads

  1. Admin page redirects to alert page
    By lakepantim in forum Installing on a Linux/Unix Server
    Replies: 2
    Last Post: 21 Oct 2010, 04:38 AM
  2. Timed page redirects
    By 0be1 in forum General Questions
    Replies: 7
    Last Post: 7 Jul 2008, 05:49 PM
  3. Page Redirects
    By andy in forum General Questions
    Replies: 6
    Last Post: 26 Mar 2008, 09:00 PM
  4. Home redirects to Product Page
    By Moose408 in forum General Questions
    Replies: 3
    Last Post: 3 Oct 2006, 09:33 PM

Posting Permissions

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