本文介绍了更改URL .htaccess的PHP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的页面名称为page.php,其网址为localhost/mysite/page.php,现在如何使用.htaccess文件将其更改为localhost/mysite/somethinghere1/somethinghere2/page.php

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>

我该如何做到这一点.

推荐答案

这是怎么回事:

RewriteRule ^somethinghere1/somethinghere2/([^/\.]+).php/?$ page.php

这篇关于更改URL .htaccess的PHP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-04 22:23