需要短URl为我的网站htaccess



我需要改变

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

但是它不影响url。我觉得代码有问题

开始:

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

由于您在localhost中并且在文件夹engineering中,因此您可以在规则中省略它。只有当你把。htaccess放到工程文件夹中才会起作用。

http://localhost/engineering/course_view.php

谢谢,

Najeem

把'[' ']'从你的规则中删除。

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

乌利希期刊指南在替换模式的开头添加'/'。

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

最新更新