我的网站 htaccess 需要短 URl
我需要更改
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
但它不影响网址。我认为代码有一些问题。
I need to change
http://localhost/engineering/management/administrator/modules/course/view.php
to
http://localhost/engineering/course_view.php
I tried the following rewriting
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^engineering/([.*])_([.*])\.php$ /engineering/management/administrator/modules/$1/$2.php
But it does not affect the url. I think the code has some problem.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我们开始吧:
由于您位于 localhost 且位于工程文件夹内,因此您可以在规则中省略它。仅当您将 .htaccess 放入工程文件夹中时,此操作才有效。
http://localhost/engineering/course_view.php
谢谢,
纳吉姆
Here we go:
Since you are in localhost and inside the folder engineering, you can omit that in rule. This works only if you place the .htaccess inside the engineering folder.
http://localhost/engineering/course_view.php
Thanks,
Najeem
只需从规则中删除 '[' ']' 即可。
UPD
在替换模式的开头添加了“/”。
PS 抱歉,我自己无法检查这条规则。我的电脑上还没有安装apache。
Just delete '[' ']' from your rule.
UPD
Added '/' at the beginnig of replace pattern.
P.S. Sorry, I can't check this rule myself. Haven't apache installed on my pc.