问题
I want to redirect below urls using htaccess
http://abc.domain.com
to http://www.domain.com/pos
http://xyz.domain.com/weighing-scales.php
to http://www.domain.com/weighing
I tried using below directive in .htaccess file but it is not working. Kindly help
Redirect 301 http://abc.domain.com http://www.domain.com/pos
Redirect 301 http://xyz.domain.com/weighing-scales.php http://www.domain.com/weighing-scales
回答1:
You can use the following :
RewriteEngine on
#--abc.domain.com/ => domain.com/pos--#
RewriteCond %{HTTP_HOST} ^abc\.domain\.com$ [NC]
RewriteRule ^$ http://domain.com/pos [L,R]
#--xyz.domain.com/weighing-scales\.php =>domain.com/weighing--#
RewriteCond %{HTTP_HOST} ^xyz\.domain\.com$ [NC]
RewriteRule ^weighing-scales\.php$ http://domain.com/weighing [L,R]
来源:https://stackoverflow.com/questions/35654713/need-htaccess-redirection