2016-11-09 57 views
0

好吧,我在Windows 10计算机上重新安装了WAMP,最新版本 - 它工作正常,只是我试图让mod_xsendfile与我的一个项目一起工作,并且我想升级以查看它是否正确有什么区别。

但是,我在重新安装后遇到了一个奇怪的问题。出于某种原因,它似乎并没有真正使用.htaccess(它的确如此,但似乎有些奇怪 - 如果我注释掉.htaccess内容,它会停止处理CSS等,所以它可以工作)。

下面是具体问题 - 我使用.htaccess制作“漂亮的网址” - 所以我可以写domain.com/gallery而不是(后者的作品)。如果我写第一个,则页面上不显示任何内容,因为如果我回显$_GET['page']变量,则返回gallery.php - 而不仅仅是gallery。如果我在做index.php?page=gallery后回显出同样的结果,它应该会回应gallery。我只是不知道它在哪里得到.php位。它不会在代码中分配,它只是在这里发生的(该网站是使用MAMP在Mac上开发的,代码在那里工作没有问题,或多或少有相同的版本:Apache 2.4.x和PHP 7.x)。

所以,这里是我的.htaccess(虽然我想也许是别的什么):

#Gzip 
<ifmodule mod_deflate.c> 
SetOutputFilter DEFLATE 
</ifmodule> 
#End Gzip 

RewriteEngine on 

RewriteRule (script|style|users|webgfx|translations|setup|conf)/(.+)$ $1/$2 [L,QSA,NC] 

RewriteRule ^(update_cookie.php|showfile.php|current_uploads.php|deletefile.php|language.php|gallery.php|quotes.php|retrieve_folder.php|check_email.php|config.php|delete_setup.php|functions.php|get_settings.php|get_update_info.php|get_userinfo.php|license.txt|login.php|process_search.php|process_setup.php|returnmessages.php|send_email.php|statistics_processing.php|update_settings.php|upload.php|process_upload.php|create_public_link.php)$ $1 [L,QSA] 

RewriteRule ^(coreclass.php|coreclass|functions.php|functions|language.php|language)$ index 

RewriteRule ^index.php?page=index|^index index.php [L,QSA,NC] 

RewriteRule ^(.*)$ index.php?page=$1 [L,QSA,NC] 

<IfModule mod_expires.c> 
# Enable expirations 
ExpiresActive On 
# Default directive 
ExpiresDefault "access plus 1 month" 
# My favicon 
ExpiresByType image/x-icon "access plus 5 years" 
# Images 
ExpiresByType image/gif "access plus 1 month" 
ExpiresByType image/png "access plus 1 month" 
ExpiresByType image/jpg "access plus 1 month" 
ExpiresByType image/jpeg "access plus 1 month" 
# CSS 
ExpiresByType text/css "access 1 month" 
# Javascript 
ExpiresByType application/javascript "access plus 1 year" 
</IfModule> 

是否有Apache或东西的任何地方的设置,将自动添加这样的“好网址.php.html “? 注意:我在文件夹中有一个gallery.php文件,但它只能通过index.php?page=gallery

加载如果还有其他东西需要提供,请告诉我。

回答

-1

你必须排除你重写到目标:

RewriteEngine on 

RewriteRule ^((?!index\.php|.*\.).*)$ /index.php?page=$1 [L,NC,QSA] 
+0

不,你其实不需要那样做 – junkfoodjunkie