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 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Nov 2012
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    htaccess redirects not working

    Hi,

    I've been trying to get some 301 redirects setup for the pages of a site that is moving Joomla install to a Wordpress site using the .htaccess. I'm having trouble getting the redirects to go to the new URLs without adding a file extension to the URL.

    Here and example:

    The original URL of the page is:
    example.com/cms/index.php/Class-Newsletters.html

    The new URL of the page is:
    example.com/site/for-class-of-2017/class-newsletters/

    I set the following for the redirect:
    Code:
    Options +FollowSymLinks
    RewriteEngine On
    Redirect 301 /cms/index.php/Class-Newsletters.html http://www.example.com/site/for-class-of-2017/class-newsletters/ [R=301,L]
    The problem is that the last slash is being removed and the .html is being added to the new URL:
    example.com/site/for-class-of-2017/class-newsletters.html

    This results in a page not found error.

    I've tried adding a $ to the end of the URL in the redirect. This prevents the .html to the new URL, but adds a $ and still ends up with a page not found.

    I'm at a loss of how to correct this. Any ideas?

    Thanks.

    Kurt

  • #2
    Regular Coder stevenmw's Avatar
    Join Date
    Jun 2007
    Location
    OK
    Posts
    497
    Thanks
    27
    Thanked 31 Times in 31 Posts
    try
    Code:
    RewriteEngine On
    RewriteRule ^contact_us\.html$ http://www.mydomain.co.uk/contact_us.php [R=301]
    RewriteRule ^myoldpage\.html$ http://www.mydomain.co.uk/mynewpage.html [R=301,L]
    Thanks!


  •  

    Tags for this Thread

    Posting Permissions

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