Link to home
Start Free TrialLog in
Avatar of Pete Long
Pete LongFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Wordpress - Redirects failing since upgrade to 4.4

Hi,

I migrated my site to wordpress a couple of months ago, and part of that process was to redirect all my old technical article URL's to the new URL

e.g (OLD SITE and Link)

http://www.petenetlive.com/KB/Article/0000213.htm

redirects to (NEW SITE and link)

http://www.petenetlive.com/KB/Article/0000213

Since the upgrade this has stopped working! (I paid a third party to migrate the website, I have no ides how they did it, how can I fix this!!)

The only thing that changes is the article number, I don't want to do a 301 for each one (theres over 1100 of them!!)


Help
Pete
Avatar of Pete Long
Pete Long
Flag of United Kingdom of Great Britain and Northern Ireland image

ASKER

Ive tried adding

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.htm -f
RewriteRule ^(.*)$ $1.htm

To the .htaccess file but them all the links fail!!!
Try
# BEGIN WordPress

# Ensure the rewriet module is loaded
<IfModule mod_rewrite.c>
# enable the rewrite engine
RewriteEngine On
# Set the root directory
RewriteBase /

RewriteRule ^(.+?)\.html?$ /$1 [L,NC,R=301]

RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

Open in new window

William, Spot on, that exactly what I needed, ThanQ

If I need to add a couple of 301 redirects where would I put them?


Regards,

Pete
spoke too soon? I upload it it worked brilliantly, now its stopped working?
Check that it hasn't changed. WordPress tends to rewrite .htaccess if you change or fiddle with the permalinks settings.

If that is the case, it may be better to place
RewriteEngine On
RewriteRule ^(.+?)\.html?$ /$1 [L,NC,R=301]

Open in new window

right at the very top of the file, outside of the WordPress commented section.
Hi it now looks like this

# Ensure the rewrite module is loaded
<IfModule mod_rewrite.c>
# enable the rewrite engine
RewriteEngine On
# Set the root directory
RewriteBase /

RewriteRule ^(.+?)\.html?$ /$1 [L,NC,R=301]
# BEGIN WordPress

RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

Open in new window



Is that OK? (it appears to be working :) Fingers Crossed!

Pete
ASKER CERTIFIED SOLUTION
Avatar of William Nettmann
William Nettmann
Flag of South Africa image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial