[英]htaccess 301 rewrite regex
I want to use htaccess to 301 redirect this: 我想使用htaccess来重定向这个:
http://olddomain.com/oldsubdir/pagename.aspx
to this: 对此:
https://www.newdomain.com/newsubdir/PAGENAME
changes: 变化:
I am assuming I will put the resulting redirect line in my .htaccess file in the root of olddomain.com. 我假设我将生成的重定向行放在olddomain.com根目录下的.htaccess文件中。 Thanks!
谢谢!
Try this code : 试试这段代码:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^olddomain.com$
RewriteRule ^oldsubdir/([a-zA-Z\.]+).aspx$ https://www.newdomain.com/newsubdir/$1 [R=301]
I don't think transform pagename to PAGENAME is possible. 我不认为将页面名转换为PAGENAME是可能的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.