I want how to do a Redirect 301 when in the url have a get
www.example.com/test/locale.action?request_locale=ca to www.example.com
*request_locale=en and request_locale=es
I use this, but doesn't works
RewriteCond %{REQUEST_URI} /test/locale.action$
RewriteCond %{QUERY_STRING} ^request_locale=ca$
RewriteRule ^.*$ http://www.example.com/? [L,R=301]
Redirect to www.example.com?request_locale=ca
The full code
<IfModule mod_security2.c>
SecRuleRemoveById 207
</IfModule>
## [GZIP] ##
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
AddOutputFilterByType DEFLATE image/svg+xml
## [EXPIRES CACHING] ##
<IfModule mime_module>
<files *.jpg>
ForceType image/jpeg
</files>
</IfModule>
<IfModule mod_expires.c>
<filesmatch "\.(jpg|jpeg|JPEG|JPG|gif|GIF|png|PNG|css|js|svg)$">
Header set Cache-Control "max-age=604800, public"
ExpiresActive on
ExpiresDefault "access plus 1 week"
</filesmatch>
</IfModule>
## [/ EXPIRES CACHING] ##
# ~~start~~ Do not remove this comment, Prestashop will keep automatically the code outside this comment when .htaccess will be generated again
# .htaccess automaticaly generated by PrestaShop e-commerce open-source solution
# http://www.prestashop.com - http://www.prestashop.com/forums
<IfModule mod_rewrite.c>
<IfModule mod_env.c>
SetEnv HTTP_MOD_REWRITE On
</IfModule>
RewriteEngine on
RewriteCond %{HTTP:Authorization} ^(.*)
RewriteRule . - [E=HTTP_AUTHORIZATION:%1]
#Domain: www.example.com
RewriteRule . - [E=REWRITEBASE:/]
RewriteRule ^api$ api/ [L]
RewriteRule ^api/(.*)$ %{ENV:REWRITEBASE}webservice/dispatcher.php?url=$1 [QSA,L]
# Images Blog
RewriteRule ^blog/([0-9]+)(\-[\.*_a-zA-Z0-9-]*)(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}modules/smartblog/images/$1$2$3.jpg [L]
RewriteRule ^blog/([a-zA-Z_-]+)(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}modules/smartblog/images/$1$2.jpg [L]
# Images
RewriteRule ^([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$1$2$3.jpg [L]
RewriteRule ^([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$1$2$3$4.jpg [L]
RewriteRule ^([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$1$2$3$4$5.jpg [L]
RewriteRule ^([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$1$2$3$4$5$6.jpg [L]
RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$5/$1$2$3$4$5$6$7.jpg [L]
RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$5/$6/$1$2$3$4$5$6$7$8.jpg [L]
RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$5/$6/$7/$1$2$3$4$5$6$7$8$9.jpg [L]
RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$5/$6/$7/$8/$1$2$3$4$5$6$7$8$9$10.jpg [L]
RewriteRule ^c/([0-9]+)(\-[\.*_a-zA-Z0-9-]*)(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/c/$1$2$3.jpg [L]
RewriteRule ^c/([a-zA-Z_-]+)(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/c/$1$2.jpg [L]
# AlphaImageLoader for IE and fancybox
RewriteRule ^images_ie/?([^/]+)\.(jpe?g|png|gif)$ js/jquery/plugins/fancybox/images/$1.$2 [L]
# Dispatcher
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ %{ENV:REWRITEBASE}index.php [NC,L]
#Domain:
RewriteRule . - [E=REWRITEBASE:/]
RewriteRule ^api$ api/ [L]
RewriteRule ^api/(.*)$ %{ENV:REWRITEBASE}webservice/dispatcher.php?url=$1 [QSA,L]
# Images
RewriteRule ^([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$1$2$3.jpg [L]
RewriteRule ^([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$1$2$3$4.jpg [L]
RewriteRule ^([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$1$2$3$4$5.jpg [L]
RewriteRule ^([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$1$2$3$4$5$6.jpg [L]
RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$5/$1$2$3$4$5$6$7.jpg [L]
RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$5/$6/$1$2$3$4$5$6$7$8.jpg [L]
RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$5/$6/$7/$1$2$3$4$5$6$7$8$9.jpg [L]
RewriteRule ^([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$2/$3/$4/$5/$6/$7/$8/$1$2$3$4$5$6$7$8$9$10.jpg [L]
RewriteRule ^c/([0-9]+)(\-[\.*_a-zA-Z0-9-]*)(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/c/$1$2$3.jpg [L]
RewriteRule ^c/([a-zA-Z_-]+)(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/c/$1$2.jpg [L]
# AlphaImageLoader for IE and fancybox
RewriteRule ^images_ie/?([^/]+)\.(jpe?g|png|gif)$ js/jquery/plugins/fancybox/images/$1.$2 [L]
# Dispatcher
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ %{ENV:REWRITEBASE}index.php [NC,L]
</IfModule>
AddType application/vnd.ms-fontobject .eot
AddType font/ttf .ttf
AddType font/otf .otf
AddType application/x-font-woff .woff
<IfModule mod_headers.c>
<FilesMatch "\.(ttf|ttc|otf|eot|woff|svg)$">
Header add Access-Control-Allow-Origin "*"
</FilesMatch>
</IfModule>
#If rewrite mod isn't enabled
ErrorDocument 404 /index.php?controller=404
# ~~end~~ Do not remove this comment, Prestashop will keep automatically the code outside this comment when .htaccess will be generated again
<IfModule mod_security.c>
SecRuleRemoveById 208
</IfModule>
<IfModule mod_security2.c>
SecRuleRemoveById 208
</IfModule>
<IfModule mod_security.c>
SecRuleRemoveById 210
</IfModule>
<IfModule mod_security2.c>
SecRuleRemoveById 210
</IfModule>
# RewriteCond %{HTTP_HOST} ^www\.example\.com [NC]
# RewriteRule ^(.*)$ http://example.com/$1 [L,R=301]
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_URI} /castell_V1/locale.action$
RewriteCond %{QUERY_STRING} ^request_locale=ca$
RewriteRule ^.*$ http://www.example.com/? [L,R=301]
RewriteCond %{HTTP_HOST} ^\.example\.com [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]
RedirectMatch 301 /castell_V1/ajuda.action http://www.example.com/content/36-ayuda
RedirectMatch 301 /castell_V1/altresProductes.action http://www.example.com
RedirectMatch 301 /castell_V1/autentica.action http://www.example.com
RedirectMatch 301 /castell_V1/avarcaNautica.action http://www.example.com
RedirectMatch 301 /castell_V1/detallCarrito.action http://www.example.com
RedirectMatch 301 /castell_V1/empresaProducte.action http://www.example.com/content/14-la-familia
RedirectMatch 301 /castell_V1/fetAMa.action http://www.example.com/content/14-la-familia
RedirectMatch 301 /castell_V1/fetDinsEspanya.action http://www.example.com/content/11-menorquinas-al-por-mayor
RedirectMatch 301 /castell_V1/formulari_1.action http://www.example.com/contactanos
RedirectMatch 301 /castell_V1/identificar.action http://www.example.com
RedirectMatch 301 /castell_V1/inici.action http://www.example.com
# RedirectMatch 301 /castell_V1/locale.action?request_locale=ca http://www.example.com
# RedirectMatch 301 /castell_V1/locale.action?request_locale=en http://www.example.com
# RedirectMatch 301 /castell_V1/locale.action?request_locale=es http://www.example.com
RedirectMatch 301 /castell_V1/noticia_id.action?noticia=12 http://www.example.com/blog
RedirectMatch 301 /castell_V1/noticia_id.action?noticia=13 http://www.example.com/blog
RedirectMatch 301 /castell_V1/noticia_id.action?noticia=4 http://www.example.com/blog
RedirectMatch 301 /castell_V1/noticia_id.action?noticia=9 http://www.example.com/blog
RedirectMatch 301 /castell_V1/noticies.action http://www.example.com/blog
RedirectMatch 301 /castell_V1/origens.action http://www.example.com/content/14-la-familia
RedirectMatch 301 /castell_V1/outletCategoria.action http://www.example.com
RedirectMatch 301 /castell_V1/producteCategoria.action http://www.example.com
RedirectMatch 301 /castell_V1/producteCategoria.action?categoria=1 http://www.example.com/609-menorquinas-hombre
RedirectMatch 301 /castell_V1/producteCategoria.action?categoria=2 http://www.example.com/608-menorquinas-mujer
RedirectMatch 301 /castell_V1/producteCategoria.action?categoria=3 http://www.example.com/610-menorquinas-nino
RedirectMatch 301 /castell_V1/registrarClient.action http://www.example.com
RedirectMatch 301 /castell_V1/representante_id.action?noticia=2 http://www.example.com/blog
RedirectMatch 301 /castell_V1/representante_id.action?noticia=3 http://www.example.com/blog
RedirectMatch 301 /castell_V1/representante_id.action?noticia=4 http://www.example.com/blog
RedirectMatch 301 /castell_V1/representante_id.action?noticia=5 http://www.example.com/blog
RedirectMatch 301 /castell_V1/representantes.action http://www.example.com/content/8-representantes
RedirectMatch 301 /castell_V1/tendes.action http://www.example.com/tiendas
RedirectMatch 301 /castell_V1/trabajaConNosotros.action http://www.example.com/content/23-trabaja-con-nosotros
RedirectMatch 301 /castell_V1/detallProducte.action http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=112 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=113 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=119 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=120 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=168 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=169 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=126 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=127 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=128 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=132 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=146 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=149 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=150 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=244 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=172 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=173 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=174 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=197 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=175 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=217 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=226 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=225 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=227 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=228 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=236 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=241 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=237 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=176 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=183 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=235 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=242 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=243 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=245 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=247 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=248 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=27 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=287 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=291 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=297 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=298 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=301 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=32 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=324 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=325 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=328 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=332 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=333 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=334 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=335 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=336 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=337 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=338 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=339 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=34 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=340 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=341 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=349 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=35 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=350 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=351 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=352 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=354 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=355 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=358 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=360 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=368 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=369 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=37 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=375 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=377 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=379 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=384 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=385 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=387 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=388 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=389 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=39 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=390 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=391 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=392 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=40 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=402 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=403 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=404 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=412 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=415 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=42 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=424 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=425 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=426 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=427 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=428 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=429 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=430 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=431 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=432 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=433 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=434 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=435 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=436 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=437 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=438 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=439 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=440 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=442 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=443 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=444 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=445 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=446 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=447 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=448 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=449 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=450 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=453 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=456 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=459 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=460 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=461 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=462 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=463 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=464 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=465 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=466 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=467 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=468 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=469 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=47 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=470 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=481 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=482 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=483 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=486 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=490 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=494 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=495 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=496 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=498 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=499 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=502 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=507 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=508 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=51 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=510 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=511 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=512 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=513 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=514 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=515 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=516 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=517 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=520 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=521 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=522 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=523 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=524 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=525 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=526 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=527 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=528 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=529 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=530 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=531 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=532 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=54 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=543 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=547 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=548 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=549 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=55 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=554 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=564 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=565 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=566 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=567 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=569 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=570 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=579 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=582 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=583 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=585 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=586 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=587 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=588 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=589 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=590 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=592 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=593 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=595 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=596 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=597 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=598 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=599 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=600 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=601 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=602 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=603 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=604 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=605 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=606 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=607 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=608 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=609 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=610 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=611 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=612 http://www.example.com
RedirectMatch 301 /castell_V1/detallProducte.action?producte=614
</IfModule>
Related
Is there any better method to use .htaccess Redirect than my current solution? Basically I mean using current method I have to specify all possible variants of folder paths they are basically component/contact/ and com_users/. Is there some common command to cover all of them?
## Begin - Custom redirects
#
# If you need to redirect some pages, or set a canonical non-www to
# www redirect (or vice versa), place that code here. Ensure those
# redirects use the correct RewriteRule syntax and the [R=301,L] flags.
#
RedirectMatch 301 /index.php/component/contact/(.*) /$1
RedirectMatch 301 /index.php/com_users/(.*) /$1
RedirectMatch 301 /index.php/en/component/contact/(.*) /$1
RedirectMatch 301 /index.php/en/component/contact(.*) /$1
RedirectMatch 301 /en/component/contact/(.*) /$1
RedirectMatch 301 /en/component/contact(.*) /$1
RedirectMatch 301 /index.php/en/com_users/(.*) /$1
RedirectMatch 301 /index.php/en/com_users(.*) /$1
RedirectMatch 301 /index.php/fi/component/contact/(.*) /$1
RedirectMatch 301 /index.php/fi/component/contact(.*) /$1
RedirectMatch 301 /fi/component/contact/(.*) /$1
RedirectMatch 301 /fi/component/contact(.*) /$1
RedirectMatch 301 /index.php/fi/com_users/(.*) /$1
RedirectMatch 301 /index.php/fi/com_users(.*) /$1
RedirectMatch 301 /index.php/ru/component/contact/(.*) /$1
RedirectMatch 301 /index.php/ru/component/contact(.*) /$1
RedirectMatch 301 /ru/component/contact/(.*) /$1
RedirectMatch 301 /ru/component/contact(.*) /$1
RedirectMatch 301 /index.php/ru/com_users/(.*) /$1
RedirectMatch 301 /index.php/ru/com_users(.*) /$1
RedirectMatch 301 /index.php/zh/component/contact/(.*) /$1
RedirectMatch 301 /index.php/zh/component/contact(.*) /$1
RedirectMatch 301 /zh/component/contact/(.*) /$1
RedirectMatch 301 /zh/component/contact(.*) /$1
RedirectMatch 301 /index.php/zh/com_users/(.*) /$1
RedirectMatch 301 /index.php/zh/com_users(.*) /$1
## End - Custom redirects
Using regex you can combine multiple rules into one:
RedirectMatch 301 /index\.php/(?:(?:en|fi|ru|zh)/)?(?:component/contact|com_users)/?(.*) /$1
RedirectMatch 301 /(?:en|fi|ru|zh)/component/contact/?(.*) /$1
I want to do my subdomains working with subdirectories without redirection.
I write this:
RewriteCond %{HTTP_HOST} ^(www\.)?mysubdomain\.site\.com$ [NC]
RewriteCond %{REQUEST_URI} !^/cities/mysubdomain/
RewriteRule ^(.*)$ /cities/mysubdomain/$1%{REQUEST_URI} [L]
It works good with mysubdomain.site.com, but all files inside directory not working. For example mysubdomain.site.com/robots.txt open site.com/robots.txt not site.com/cities/subdomain/robots.txt (that what I want)
Can you help with explanation?
My current .htaccess is:
Options -Indexes
ErrorDocument 404 /404.php
<IfModule mod_php5.c>
php_flag allow_call_time_pass_reference 1
php_flag session.use_trans_sid off
#php_value display_errors 1
#php_value mbstring.func_overload 2
#php_value mbstring.internal_encoding UTF-8
</IfModule>
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/
RewriteRule ^index\.php$ http://example.com [R=301,L]
# sub-domain redirect
RewriteCond %{HTTP_HOST} ^(www\.)?sub\.example\.com$ [NC]
RewriteCond %{REQUEST_URI} !^/cities/barnaul/ [NC]
RewriteRule ^(.*)$ /cities/barnaul/$1 [L,QSA]
# sub-domain redirect
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !/bitrix/urlrewrite.php$
RewriteRule ^(.*)$ /bitrix/urlrewrite.php [L]
RewriteRule .* - [E=REMOTE_USER:%{HTTP:Authorization}]
</IfModule>
<IfModule mod_expires.c>
ExpiresActive on
ExpiresByType image/jpeg "access plus 3 day"
ExpiresByType image/gif "access plus 3 day"
</IfModule>
RewriteCond %{HTTP_HOST} ^www.example.com$ [NC]
RewriteRule ^(.*)$ http://example.com$1 [R=301,L]
Redirect 301 /cities/sms-sending-samara.php http://sub.example.com
Redirect 301 /information/sms_directing.php http://example.com/#sms_directing
Redirect 301 /sitemap_000.xml http://example.com/sitemap.xml
Redirect 301 /information/information.php http://example.com/information/
Redirect 301 /help/%D0%9C%D0%BE%D0%B4%D1%83%D0%BB%D1%8C%201%D0%A1%20v8.2.pdf http://example.com/api/modul_1c.php
Redirect 301 /help/Модуль%201С%20v8.2.pdf http://example.com/api/modul_1c.php
Redirect 301 /api/modul.php http://example.com/api/modul_1c.php
Redirect 301 /help/HTTP.pdf http://example.com/api/prot_http.php
Redirect 301 /help/SMPP.pdf http://example.com/api/prot_smpp.php
Redirect 301 /help/SMTP.pdf http://example.com/api/prot_smtp.php
Redirect 301 /help/SOAP.pdf http://example.com/api/prot_soap.php
Redirect 301 /help/XML.pdf http://example.com/api/prot_xml.php
Redirect 301 /API/prot_http.php http://example.com/api/prot_http.php
Redirect 301 /API/prot_smpp.php http://example.com/api/prot_smpp.php
Redirect 301 /API/prot_smtp.php http://example.com/api/prot_smtp.php
Redirect 301 /API/prot_soap.php http://example.com/api/prot_soap.php
Redirect 301 /API/prot_xml.php http://example.com/api/prot_xml.php
Redirect 301 /rassilka_sms_internet.html http://example.com/rassilka_sms_cherez_internet.html
Redirect 301 /sms_rassilka_cherez_internet_01.html http://example.com/rassilka_sms_cherez_internet.html
Redirect 301 /internet_rassilka_sms.html http://example.com/rassilka_sms_cherez_internet.html
Redirect 301 /sms_uvedomlenie_2.html http://example.com/sms_uvedomlenie.html
Redirect 301 /sms_uslugi_2.html http://example.com/sms_uslugi.html
Redirect 301 /sms_rassilka_reklamy_01.html http://example.com/sms_rassilka_reklamy.html
Redirect 301 /sms_rassilka_03.html http://example.com
Redirect 301 /sms_rassilka.html http://example.com
Redirect 301 /rassilka_sms_02.html http://example.com
Redirect 301 /rassilki_sms_01.html http://example.com
Redirect 301 /sms_reklama.html http://example.com/information/reklama.php
Redirect 301 /sms_rassilka_deshevo.html http://example.com/rassilka_sms_deshego.html
Redirect 301 /sms_rassilka_deshevo01.html http://example.com/rassilka_sms_deshego.html
Redirect 301 /rassilka_sms_internet.html http://example.com/rassilka_sms_cherez_internet.html
Redirect 301 /programma_cmc.html http://example.com/programma_sms.html
Redirect 301 /korporativnye_sms.htm http://example.com/korporativnye_sms.html
Redirect 301 /information/sector/index.php http://example.com/reshenia/
Redirect 301 /massovaya_rassilka_sms.html http://example.com
Redirect 301 /API/ http://example.com/api/
Redirect 301 /API http://example.com/api/
Redirect 301 /sms_trafik.htm http://example.com/smstrafik.html
Redirect 301 /sms_shluz.htm http://example.com/smsshluz.html
Redirect 301 /sms_trafik.html http://example.com/smstrafik.html
Redirect 301 /sms_shluz.html http://example.com/smsshluz.html
Redirect 301 /information/sms_reklama.php http://example.com/information/reklama.php
Redirect 301 /rassilka_ http://example.com
Redirect 301 /information/ackciya.php http://example.com/information/post_akciya.php
Redirect 301 /information/akciya.php http://example.com/information/post_akciya.php
Redirect 301 /information/sector/gov/ http://example.com/reshenia/gosstruktury/
Redirect 301 /information/sector/ http://example.com/reshenia/
Redirect 301 /information/MMS_directing.php http://example.com
Redirect 301 /information/WAP_directing.php http://example.com
Redirect 301 /information/voice_directing.php http://example.com
Redirect 301 /mobilny_marketing.html http://example.com/mobilnymarketing.html
Redirect 301 /cities/sms-sending-belgorod.php http://sub.example.com
AddDefaultCharset cp1251
Whenever these 301 redirects are added to a .htaccess file (content follows) I get a 500 Internal Sever error - and idea why?
Much thanks in advance...
Richard
# 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
# BEGIN Permanent URL redirects
Redirect 301 /about-cs.html www.christian-simpson.com/about-christian-simpson/
Redirect 301 /entrepreneurial-success.html www.christian-simpson.com/entrepreneurial-success/
Redirect 301 /advanced-thinking.html www.christian-simpson.com/advanced-thinking/
Redirect 301 /become-a-coach.html www.christian-simpson.com/become-a-coach/
Redirect 301 /speaking.html www.christian-simpson.com/speaking/
Redirect 301 /resources.html www.christian-simpson.com/resources/
Redirect 301 /praise.html www.christian-simpson.com/testimonials/
Redirect 301 /store.html www.christian-simpson.com/store/
Redirect 301 /contact.html www.christian-simpson.com/contact/
Redirect 301 /privacy.html www.christian-simpson.com/privacy-policy/
Redirect 301 /anti-spam.html www.christian-simpson.com/anti-spam-policy/
Redirect 301 /terms.html www.christian-simpson.com/terms-of-service/
# END Permanent URL redirects
There are few problems:
Mixing of mod_alias and mod_rewrite rules.
Not using http:// in target URI.
Keeping redirect rule after rewrite ones.
To fix this you can use:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
# BEGIN Permanent URL redirects
RewriteRule ^about-cs\.html$ /about-christian-simpson/? [L,R=301,NC]
RewriteRule ^entrepreneurial-success\.html$ /entrepreneurial-success/? [L,R=301,NC]
# other 301 rules here
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
How can I redirect via 301, from http://mydomain.com/index.php to http://mydomain.com or http://mydomain.com/variable to http://mydomain.com ? I tried this, but doesn't work:
Options +FollowSymlinks
RewriteEngine on
rewritecond %{http_host} ^http://mydomain.com/variable [nc]
rewriterule ^(.*)$ http://mydomain.com/$1 [r=301,nc]
Try:
RedirectMatch 301 ^/index.php$ /
RedirectMatch 301 ^/variable$ /
I site that I've inherited for some reason was set up with www- as well as www.
To clarify, both of these URLs work:
http://www-mcr.trinhall.cam.ac.uk
http://www.mcr.trinhall.cam.ac.uk
I want to get all traffic using the www- to redirect to the www.
I thought that I'd nailed it with the following htaccess rules, but they don't seem to be working. Any help would be much appreciated!
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www.mcr.trinhall.cam.ac.uk$ [NC]
RewriteRule ^(.*)$ http://www.mcr.trinhall.cam.ac.uk/$1 [L,R=301]
The full .htaccess file is below:
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www.mcr.trinhall.cam.ac.uk$ [NC]
RewriteRule ^(.*)$ http://www.mcr.trinhall.cam.ac.uk/$1 [L,R=301]
RedirectMatch 301 ^/wiki/International_Students http://www.mcr.trinhall.cam.ac.uk/prospective-students/international/
RedirectMatch 301 ^/wiki/McMenemy_Seminar http://www.mcr.trinhall.cam.ac.uk/academics/mcmenemy-seminars/
RedirectMatch 301 ^/wiki/Welfare http://www.mcr.trinhall.cam.ac.uk/welfare/counselling/
RedirectMatch 301 ^/wiki/Transportation http://www.mcr.trinhall.cam.ac.uk/prospective-students/getting-around/
RedirectMatch 301 ^/wiki/Grants http://www.mcr.trinhall.cam.ac.uk/college-support/grants-and-funding/
RedirectMatch 301 ^/wiki/Grants_and_Funding http://www.mcr.trinhall.cam.ac.uk/college-support/grants-and-funding/
RedirectMatch 301 ^/wiki/Cake http://www.mcr.trinhall.cam.ac.uk/welfare/peer-support/
RedirectMatch 301 ^/wiki/Disability_Access http://www.mcr.trinhall.cam.ac.uk/welfare/students-with-disabilities/
RedirectMatch 301 ^/wiki/Recycling_Instructions http://www.mcr.trinhall.cam.ac.uk/current-college-residents/green/
RedirectMatch 301 ^/wiki/Bateman_Street http://www.mcr.trinhall.cam.ac.uk/prospective-students/accommodation/
RedirectMatch 301 ^/wiki/Life_in_Cambridge http://www.mcr.trinhall.cam.ac.uk/prospective-students/eating-in-cambridge/
RedirectMatch 301 ^/wiki/Prospective_Students http://www.mcr.trinhall.cam.ac.uk/prospective-students/accommodation/
RedirectMatch 301 ^/wiki/Leslie_Stephen_Room http://www.mcr.trinhall.cam.ac.uk/college-facilities/function-rooms/
RedirectMatch 301 ^/wiki/Dining http://www.mcr.trinhall.cam.ac.uk/dining-in-college/formal-dinners/
RedirectMatch 301 ^/wiki/Mailing_list http://www.mcr.trinhall.cam.ac.uk/your-mcr/mailing-lists/
RedirectMatch 301 ^/wiki/MCR_Committee http://www.mcr.trinhall.cam.ac.uk/your-mcr/committee/
#RedirectMatch 301 ^/wiki/ http://www.mcr.trinhall.cam.ac.uk/
# 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
The problem is in this line:
RewriteCond %{HTTP_HOST} !^www.mcr.trinhall.cam.ac.uk$ [NC]
You NEED to escape dot . character if you want to achieve what you want. In regular expressions the dot character means ANY character. You current regex will match www.mcr.trinhall.cam.ac.uk as well as www-mcr-trinhall-cam-ac-uk as well as www8mcr8trinhall8cam8ac8uk etc -- you have got the idea.
To solve it escape the dots:
RewriteCond %{HTTP_HOST} !^www\.mcr\.trinhall\.cam\.ac\.uk$ [NC]
or use non-regex match (plain string comparison):
RewriteCond %{HTTP_HOST} !=www.mcr.trinhall.cam.ac.uk [NC]