更改 url .htaccess php
我有一个页面名称 page.php
,我的网址为 localhost/mysite/page.php
,现在如何使用 .htaccess
更改网址> 文件到 localhost/mysite/somethinghere1/somethinghere2/page.php
它尝试使用下面的代码,但没有成功。
<IfModule mod_rewrite.c>
# Enable Rewriting
RewriteEngine On
# Rewrite user URLs
# Input: user/NAME/
# Output: user.php?id=NAME
RewriteRule ^somethinghere1/somethinghere2/.php? page.php
</IfModule>
我怎样才能做到这一点。
I have a page name page.php
and my url as localhost/mysite/page.php
, now how can i change the url using .htaccess
file to localhost/mysite/somethinghere1/somethinghere2/page.php
It tried using the below code but it doesn't work out.
<IfModule mod_rewrite.c>
# Enable Rewriting
RewriteEngine On
# Rewrite user URLs
# Input: user/NAME/
# Output: user.php?id=NAME
RewriteRule ^somethinghere1/somethinghere2/.php? page.php
</IfModule>
how can i acheive this.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这个怎么样:
What about this:
像这样使用它:
还要确保它位于 DOCUMENT_ROOT 目录中的 .htaccess 文件中。
Use it like this:
Also make sure this in .htaccess file in your DOCUMENT_ROOT directory.
这是基本代码,您可以使用它来满足您的需求,如以下编辑:
所以 x/y/z 将是 z.php?first=x&second=y
This is the basic code , you can play with it to fit your needs like the following edit :
So x/y/z would be z.php?first=x&second=y