Reputation:
I want to edit Wordpress 3.5 .htaccess file to define some url redirect rules eg:
Redirect http://localhost/my_site/blog/cat/hello-world to http://localhost/my_site/cat/hello-world
I tried
Redirect 301 /localhost/my_site/blog/cat/hello-world/ http://localhost/my_site/hello-world/
and also
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /my_site/
Redirect 301 http://localhost/my_site/blog/cat/hello-world/ http://localhost/my_site/cat/hello-world/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /my_site/index.php [L]
</IfModule>
but browser says
Page Not Found
This is somewhat embarrassing, isn’t it?
any idea.. how can i do this..?
Upvotes: 0
Views: 8433
Reputation: 143846
You don't want to use Redirect
in conjunction with mod_rewrite, just stick with mod_rewrite. Replace the Redirect
with:
RewriteRule ^my_site/blog/cat/hello-world/ /my_site/cat/hello-world/ [L,R=301]
Upvotes: 1