Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Sep 2007
    Posts
    238
    Thanks
    9
    Thanked 0 Times in 0 Posts

    htaccess URL Rewrite not working after 301 redirect

    I have the following url rewrite:

    Code:
    RewriteRule ^info/([^/\.]+)/?$ info.php?page=info&subpage=$1 [L]
    Originally the parameters were the page id's i.e. 0-10. I have now changed this so the URLs have more meaningful slug names to reflect the content.

    I have now set up the 301 redirects, for example:

    Code:
    Redirect 301 /info/0 http://www.example.com/info/intro
    But the problem is, the redirect doesn't go to the url rewrite (http://www.example.com/info/intro). Instead it shows the full url (http://www.example.com/info.php?page=info&subpage=0)

    How can it get it to keep the rewrite?
    Many thanks

  • #2
    New Coder
    Join Date
    Jul 2011
    Posts
    67
    Thanks
    0
    Thanked 13 Times in 13 Posts
    Are you clicking a link on your site or attempting to type the address in the URL? Either way what is the URL you are attempting (either typing or the href value of the link you are clicking)?

  • #3
    Regular Coder
    Join Date
    Sep 2007
    Posts
    238
    Thanks
    9
    Thanked 0 Times in 0 Posts
    Changing the redirect to a rewriterule did the trick
    Code:
    RewriteRule ^info/0$ http://www.example.com/info/intro [R=301,L]


  •  

    Posting Permissions

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