RewriteRule 实际上不适用于 xampp
Posted
技术标签:
【中文标题】RewriteRule 实际上不适用于 xampp【英文标题】:RewriteRule not actually work with xampp 【发布时间】:2016-02-20 14:15:51 【问题描述】:我在 .htacces 中挥动以下代码:
Options -MultiViews
RewriteEngine on
RewriteBase /app/
RewriteRule ^login/?$ login.php [NC,L]
RewriteRule ^register/?$ register.php [NC,L]
RewriteRule ^recover/?$ recover.php [NC,L]
RewriteRule ^all/?$ home.php [NC,L]
RewriteRule ^chats/?$ chats.php [NC,L]
RewriteRule ^manage-photos/?$ manage-photos.php [NC,L]
RewriteRule ^friends/?$ friends.php [NC,L]
RewriteRule ^upgrades/?$ upgrades.php [NC,L]
RewriteRule ^profile/([0-9]+)$ profile.php?id=$1 [NC,L]
RewriteRule ^gifts/([0-9]+)$ gifts.php?id=$1 [NC,L]
RewriteRule ^friends/([0-9]+)$ friends.php?id=$1 [NC,L]
RewriteRule ^chat/([0-9]+)$ chat.php?id=$1 [NC,L]
RewriteRule ^page/([0-9]+)$ page.php?id=$1 [NC,L]
RewriteRule ^settings/?$ settings.php [NC,L]
RewriteRule ^preferences/?$ preferences.php [NC,L]
RewriteRule ^profile-views/?$ profile-views.php [NC,L]
RewriteRule ^hot-list/?$ hot-list.php [NC,L]
RewriteRule ^process/([A-Za-z0-9]+)$ process.php?t=$1 [NC,L]
我有 xampp 工作,该模块在 httpd.conf 中启用。 我在这个conf中有代码:
# Deny access to the entirety of your server's filesystem. You must
# explicitly permit access to web content directories in other
# <Directory> blocks below.
#
<directory />
Require all denied
AllowOverride none
</directory>
#
# Note that from this point forward you must specifically allow
# particular features to be enabled - so if something's not working as
# you might expect, make sure that you have specifically enabled it
# below.
#
我没有改变这个,所有其他 AllowOverride 都是 ALL ! ,是我的问题,在每个链接上我都找不到对象。 我想要的是 www.mydomain.com/site/APP/LOGIN 可用,或者 www.mydomain.com/site/APP/LOGIN/profile/20 而不是 profile.php?id=$1。 类型
【问题讨论】:
mod_rewrite 在 Xampp 中是否有效?另外,检查错误日志,也许你可以在那里找到线索。 是的,已开启,我在任何日志中都没有任何内容 :( 请有人回答,因为我使用以下方法:RewriteBase subfolder/app/ RewriteRule login/?$ login.php [NC,L] 因为一切都在一个子文件夹中 :) 您也可以回答自己的问题。 谢谢 CGeorges,我现在回答了,但明天我可以选择那个答案 【参考方案1】:RewriteBase subfolder/app/
RewriteRule login/?$ login.php [NC,L]
因为一切都在一个子文件夹中:)
【讨论】:
以上是关于RewriteRule 实际上不适用于 xampp的主要内容,如果未能解决你的问题,请参考以下文章