I have reviewed the many questions posted here related to .htaccess
, apache
, mod-rewrite
and regex
, but I'm just not getting it. I tried a few different things but either I am over complicating things or making beginner mistakes. Regardless, I've been at it a few days now and have completely scrambled things somewhere as the 10000 404's per day are showing.
My site
I have a WordPress site which contains over 23,000 posts broken down into just over 1200 categories. The site features streaming video files, industry news, show reviews, movies, phpbb forums, etc. and is structured like this:
- site / base categories ( 0 and a-z) / sub categories (series name) /
posts (episode name .html )for all streaming media episodes
- site / movies / post title.html for all streaming movies
- site / news / posttitle.html
- site / reviews / posttitle.html
- site / page.html for assorted pages
- site / forums
Permalink structure is /%category%/%postname%.html
I have am using the Yoast Wordpress SEO plugin and have the option to append a trailing slash enabled for directories and categories.
here is the current .htaccess
# 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
My examples
From our old site structure we have many inbound links using "/episode title/". This is wrong. We need these incoming links to redirect to /watch-anime/letter, number or symbol only 1 character long/series title/episode title.html
/one-piece-episode-528?/
should be
/watch-anime/o/one-piece/?one-piece-episode-528?.html
A mistake I made caused this problem... "/watch-anime/letter/series title/episode title/
" to "/watch-anime/letter/series title/episode title.html
". So, we need to remove trailing slash from single posts and add .html
/watch-anime?/w?/welcome-to-the-nhk?/welcome-to-the-nhk-episode-14?/
should be
/watch-anime?/w?/welcome-to-the-nhk?/welcome-to-the-nhk-episode-14?.html
The same mistake caused this problem when combined with the old site structure issue... "/episode title.html
" needs to be "/watch-anime/letter/series title/episode title.html
"
/one-piece-episode-528?.html
needs to be
/watch-anime/o/one-piece/?one-piece-episode-528?.html
As you can see, I've made a mess of things between migrating the sites post structure and my attempts to fix it. I am now asking for any help you can provide in getting a proper .htaccess file that will take care of these 301 redirects.
Thanks for any assistance you can provide!
See Question&Answers more detail:
os