Rewrite only the middle part of URL - mod rewrite .htaccess
10,076
You need to use R
flag in your rule and avoid using http://
or https://
in target URL.
RewriteEngine On
RewriteRule ^cadeaushop/(.*)$ /hobby-cadeau-shop/$1 [R=302,NE,L]
Also important is to keep this rule just below RewriteEngine On
OR RewriteBase
line.
Author by
Admin
Updated on June 05, 2022Comments
-
Admin almost 2 years
I want to change
cadeaushop
part in the url tohobby-cadeau-shop
. I made the following mod rewrite in my htaccess file:RewriteRule ^cadeaushop/(.*) http://www.zovyo.nl/hobby-cadeau-shop/$1 [QSA,L]
It works nice, but on one place I want something else. the shopping cart uses https, a secure url. Now this url is also set to http.
How can I change the mod rewrite so the first part of the url doesn't change? I tried some changes, like
RewriteRule ^cadeaushop/(.*) /hobby-cadeau-shop/$1 [QSA,L]
But this don't work.
Thanks in advance.
Regards, Martin