Home > Mobile >  .htaccess rewriteCond part of the url
.htaccess rewriteCond part of the url

Time:08-25

URL applying rule(s):

https://olddomain.ch/de/qahmkitd73/
https://olddomain.ch/fr/qahmkitd73/ 
https://olddomain.ch/en/qahmkitd73/ 

RewriteCond %{HTTP_HOST} chezcamillebloch\.ch$
RewriteCond %{REQUEST_URI} ^\/.*\/qahmkitd73\/$ [NC]
RewriteRule .* https://newdomain.ch/$1/qahmkitd73 [NE,R=301,L]

this should redirect to https://newdomain.ch/**/qahmkitd73 the ** should be dynamic from the URL (de/ or en/ or fr/)

CodePudding user response:

You could keep your .htaccess rules file in following manner. Please make sure to clear your browser cache before testing your URLs.

RewriteEngine ON
RewriteCond %{HTTP_HOST} ^(?:www\.)?olddomain\.ch$  [NC]
RewriteRule ^ http://newdomain.ch/%{REQUEST_URI} [R=301,NE,L]

CodePudding user response:

this should redirect to https://newdomain.ch/**/qahmkitd73 the ** should be dynamic from the URL (de/ or en/ or fr/)

You may use this redirect rule:

RewriteEngine On

RewriteCond %{HTTP_HOST} ^(?:www\.)?olddomain\.ch$ [NC]
RewriteRule ^(en|fr|de)/qahmkitd73/?$ http://newdomain.ch%{REQUEST_URI} [R=301,NC,L]
  • Related