My .htaccess has the following code :
RewriteRule ^([A-Z]+)$ listings/$1 [R=301]
RewriteRule ^listings/([A-Z]+)/?$ listings_state.php?state=$1 [NC,L]
With this rule I am trying to achieve 301 redirect from spb.com/test_1/XY
to spb.com/test_1/listings/XY
However, it is redirecting to spb.com/path/to/test_1/in_server/test_1/listings/CT
and I tried changing .htaccess to as follows:
RewriteRule ^([A-Z]+)$ /listings/$1 [R=301]
RewriteRule ^listings/([A-Z]+)/?$ listings_state.php?state=$1 [NC,L]
RewriteRule ^/([A-Z]+)$ /listings/$1 [R=301]
RewriteRule ^listings/([A-Z]+)/?$ listings_state.php?state=$1 [NC,L]
RewriteRule ^/([A-Z]+)$ /listings/$1 [R=301]
RewriteRule ^/listings/([A-Z]+)/?$ listings_state.php?state=$1 [NC,L]
Nothing seems to work.
Please guide me in this regard. Thank you community :)
question from:
https://stackoverflow.com/questions/65880629/redirected-url-through-htaccess-is-being-redirected-to-the-different-location 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…