重定向的Htaccess问题


Htaccess issue with redirection?

我正在尝试将www.mysite.com/movie/name重定向到www.mysite.com/movie/?url=name为此,我在movie/folder中添加了htaccess,我添加的代码如下:

RewriteEngine On
RewriteBase /movie/
RewriteEngine On
RewriteRule ^([a-zA-Z0-9_-]+).html$ index.php?id=$1
RewriteRule ^([a-zA-Z0-9_-]+)/$ index.php?id=$1

我无法重定向它,谁能建议我正确的方法来完成这一点?

只是一个小小的改变,应该可以工作。试试下面的代码,让我知道它是否适合你。

RewriteEngine On
RewriteRule ^([a-zA-Z0-9-/]+).html$ index.php?id=$1
RewriteRule ^([a-zA-Z0-9-/]+).html/$ index.php?id=$1

首先,您只需要编写一次命令RewriteEngine On

另外,替换

的最后一条规则

RewriteRule ^([a-zA-Z0-9_-]+)$ index.php?id=$1

错误在最后一个反斜杠