[英]htaccess redirect 301 and rewrite
I am trying to simplify URLs from 我正在尝试简化以下网址
xyz.com/walks/walk_descrip/8010/ to xyz.com/walk-8010 xyz.com/walks/walk_descrip/8010/到xyz.com/walk-8010
I have moved the file from the walks sub-directory to the root. 我已将文件从walks子目录移至根目录。
I have tried using the following in my htaccess file 我已经尝试在htaccess文件中使用以下内容
Redirect 301 ^/walks/walk_descrip/(.*)/$ /walk-$1
RewriteRule ^walk-(.*)$ /walk-description.php?id=$
However this is producing URLs such as 但是,这会产生诸如
xyz.com/walk-8010?id=8010
Where am I going wrong? 我要去哪里错了?
Any help would be appreciated 任何帮助,将不胜感激
Redirect directive doesnt support regex. 重定向指令不支持正则表达式。 What you are looking for is RedirectMatch.
您正在寻找的是RedirectMatch。
RedirectMatch 301 ^/walks/walk_descrip/(.+)$ /walk-$1
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.