Link to home
Start Free TrialLog in
Avatar of sharingsunshine
sharingsunshineFlag for United States of America

asked on

Need to stop old links from going to home page

I am moving a site to WooCommerce which uses different url's that my old Prestashop site.  I have found that the old url's are going to the home  page instead of showing a 404.  I need to remove whatever is going to the home page.  This is because I want to run xml-sitemaps.com to find the broken links.  However, they aren't showing up because they are going to the home page automatically.

This is the .htaccess in the public directory where wordpress resides

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

Open in new window


Please tell me how to get these old links to show a 404.

Thanks,

Randal
SOLUTION
Avatar of gr8gonzo
gr8gonzo
Flag of United States of America 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
Avatar of sharingsunshine

ASKER

the majority of them take either form:

http://www.abc.com/index.php?controller=cms&id_cms=[any number]

/index.php?controller=cms&id_cms=[any number]
For a Wordpress site?
those are links from my prestashop site, that I am converting from, that should show a 404
I recommend to avoid 404 at all costs and suggest that you make a catch-all and/or do 301 "Moved Permanently" redirects to preserve your SEO 'ranking'. This catch-all looks to be done by Wordpress' default htaccess.

However, if you need to stop the catch-all to do the testing you mentioned, try commenting out the lines temporarily:

# BEGIN WordPress
#<IfModule mod_rewrite.c>
#RewriteEngine On
#RewriteBase /
#RewriteRule ^index\.php$ - [L]
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-d
#RewriteRule . /index.php [L]
#</IfModule>

# END WordPress

Open in new window


Warning: this stops your WordPress from working correctly while you are testing.

The better way of doing this is to gather the links you had, and 301 them to the new links you will create. In other words, a 1:1 permanent redirect. Widget #1 on your old site gets redirected to Widget #1 on your redesign.
ASKER CERTIFIED SOLUTION
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
Thanks for the help and the code.