我需要改变
http://localhost/engineering/management/administrator/modules/course/view.php
http://localhost/engineering/course_view.php
使用htaccess Options +FollowSymlinks
RewriteEngine on
RewriteRule ^(.*)_(.*)'.php$ management/administrator/modules/$1/$2.php
RewriteRule ^(.*)_(.*)'.php$ management/user/modules/$1/$2.php
可以正常工作,
但是对于下面的url,它不起作用
http://localhost/engineering/management/user/modules/data/edit.php
请尝试使用此代码:-
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^(.*)_(.*)'.php$ management/administrator/modules/$1/$2.php
RewriteRule ^(.*)_(.*)'.php$ management/user/modules/$1/$2.php
希望能有所帮助。
当你使用这个!
RewriteRule (.*)_(.*)'.php management/administrator/modules/$1/$2.php
因为它可以重写其他url(您已经提到的),所以您可以添加特殊的部分来避免这样的事情。例句:
RewriteRule swd(.*)_(.*)'.php management/administrator/modules/$1/$2.php
和url:
http://localhost/engineering/swdcourse_view.php
和第二个,使用swd
以外的其他字符!!
RewriteRule ^usr(.*)_(.*)'.php$ management/user/modules/$1/$2.php