Forum Moderators: phranque
I just moved my site to Wordpress. The URL structures between the old and new sites vary greatly, so I implemented a ton of 301 redirects in my .htaccess file.
The final thing I'd like to do is implement a "catch all" redirect for any links that I may have missed.
I'm not looking to do anything fancy with sub-folders and such (like in the other posts I've read). I'd just like the traffic to be redirected to my homepage.
For example, if someone goes to [mysite.com...]
...they will be redirected to [mysite.com...]
Obviously, I don't want to screw up the page-specific redirects already in place.
Thanks in advance for any help you can provide.
My current .htaccess file looks like this:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
# BEGIN WordPress
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
***A bunch of 301 redirects here***
Note also that your external redirect directives should precede your internal rewrites unless they are completely mutually-exclusive.
Jim
Your 404 page is irrelevant because it won't ever be invoked with that WP code in place.
Jim
Currently, if someone types www.mysite.com/a-file-that-doesn't-exist, they get a 404 error on my new Wordpress site. I'd rather they be redirected to my Wordpress site's homepage.
So, I'm not sure what you mean by "your 404 page...won't ever be invoked." Do you mean my "old" site's 404 page?
I haven't changed domain names. I simply moved my site from one host and CMS to another...and I want any URLs not currently specified by 301 to wind up on my NEW homepage.
Thanks.
So with that code in place, you can't get a 404 handled by Apache (assuming that the .htaccess file is located at example.com/.htaccess) -- All requests that would result in a 404 would be handled by WordPress itself.
Jim