1

我需要改变

http://localhost/engineering/management/administrator/modules/course/view.php

http://localhost/engineering/course_view.php

我尝试了以下重写

Options +FollowSymlinks
RewriteEngine on
RewriteRule ^engineering/([.*])_([.*])\.php$  /engineering/management/administrator/modules/$1/$2.php

但它不影响网址。我认为代码有问题。

4

2 回答 2

1

只需从您的规则中删除 '[' ']' 即可。

RewriteRule ^/engineering/(.*)_(.*)\.php$  /engineering/management/administrator/modules/$1/$2.php

UPD 在替换模式的开头添加了“/”。

PS对不起,我不能自己检查这个规则。我的电脑上没有安装apache。

于 2011-07-22T05:19:39.800 回答
1

开始了:

Options +FollowSymlinks
 RewriteEngine on
 RewriteRule ^(.*)_(.*)\.php$ management/administrator/modules/course/view.php

由于您在本地主机和文件夹工程内,您可以在规则中省略它。这仅在您将 .htaccess 放在工程文件夹中时才有效。

http://localhost/engineering/course_view.php

谢谢,

纳吉姆

于 2011-07-28T17:41:09.377 回答