Go Back   CodingForums.com > :: Server side development > Apache configuration

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 11-20-2012, 01:36 AM   PM User | #1
lesterj
New to the CF scene

 
Join Date: Nov 2012
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
lesterj is an unknown quantity at this point
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
lesterj is offline   Reply With Quote
Old 11-29-2012, 10:05 AM   PM User | #2
stevenmw
Regular Coder

 
stevenmw's Avatar
 
Join Date: Jun 2007
Location: OK
Posts: 449
Thanks: 26
Thanked 30 Times in 30 Posts
stevenmw is an unknown quantity at this point
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!
stevenmw is offline   Reply With Quote
Reply

Bookmarks

Tags
301 redirects, apache, htaccess, redirects

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 11:17 AM.


Advertisement
Log in to turn off these ads.