Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.htaccess redirecting broken URLs

I updated a website but the links doesn't work properly anymore. I have some urls but they don't work anymore:

http://www.mysite.eu/fr/some-page
http://www.mysite.eu/fr/some-page1
http://www.mysite.eu/fr/some-page2

Is it possible to redirect the page when there is an /fr/ in the url? I've tried

Redirect 301 /fr/ http://www.mysite.eu/

but that only strips the /fr/.

like image 862
Sam De Decker Avatar asked Oct 13 '12 12:10

Sam De Decker


1 Answers

Great! So if you have mod_rewrite activated you can rewrite the broken links, instead of redirecting them

# BEGIN WordPress 
<IfModule mod_rewrite.c> 
RewriteEngine On 
RewriteBase / 
RewriteRule ^fr/(.)*$ / [R=301,NC,L]  # Added line
RewriteRule ^index\.php$ - [L] 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule . /index.php [L] 
</IfModule> 
# END WordPress 
like image 165
Havelock Avatar answered Sep 23 '22 05:09

Havelock