繁体   English   中英

PHP Bootstrap可以在localhost上完美运行,但不能在VPS上运行

[英]PHP Bootstrap working perfectly on localhost but not working on VPS

我的Bootstrap / PHP代码在XAMPP本地主机上无法正常运行时遇到了问题,但是当我在服务器上安装了Apache和MySQL并将其上传到/ var / www文件夹时,突然看起来.htaccess出现了问题。 我该怎么办? 我是否需要在VPS上安装XAMPP之类的东西? VPS具有Linux Ubuntu Debian-7.0(64位)。

我的.htaccess文件:

RewriteEngine On
Allow from all
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^password-reset/([^\/]+)(\/|)$  index.php?tab1=welcome&tab2=password_reset&user_id=$1 [NC,QSA]
RewriteRule ^admin/(.*)$ index.php?tab1=admin [NC,QSA]
RewriteRule ^saved-posts/(.*)$ index.php?tab1=saved-posts [NC,QSA]
RewriteRule ^activated/(.*)$ index.php?tab1=activate&tab2=$1 [NC,QSA]
RewriteRule ^search/([^\/]+)(\/|)$ index.php?tab1=search&query=$1 [NC,QSA]
RewriteRule ^app/([^\/]+)(\/|)$ index.php?tab1=app&app_id=$1 [NC,QSA]
RewriteRule ^messages/([^\/]+)(\/|)$  index.php?tab1=messages&user=$1 [QSA]
RewriteRule ^terms/([^\/]+)(\/|)$  index.php?tab1=terms&type=$1 [QSA]
RewriteRule ^setting/([^\/]+)(\/|)$  index.php?tab1=setting&user=$1 [QSA]
RewriteRule ^page-setting/([^\/]+)(\/|)$  index.php?tab1=page-setting&page=$1 [QSA]
RewriteRule ^post/([^\/]+)(\/|)$ index.php?tab1=post&id=$1 [NC,QSA]
RewriteRule ^hashtag/([^\/]+)(\/|)$ index.php?tab1=hashtag&hash=$1 [NC,QSA]
RewriteRule ^follow-requests/(.*)$ index.php?tab1=follow-requests[NC,QSA]
RewriteRule ^@([A-Za-z0-9_]+)/([^\/]+)(\/|)$  index.php?tab1=timeline&u=$1&type=$2 [NC,QSA]
RewriteRule ^p/([^\/]+)(\/|)$ index.php?tab1=page&p=$1 [NC,QSA]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^@([A-Za-z0-9_]+)(\/|)$  index.php?tab1=timeline&u=$1 [NC,QSA]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^\/]+)(\/|)$  index.php?tab1=$1 [QSA]

如果您有权访问Apache配置,则需要启用mod_rewrite Apache模块,并将AllowOverride选项设置为all

mod_rewrite是一个Apache模块,允许您设置URL的重写规则。

通常,默认情况下, AllowOverride通常设置为none ,这将导致htaccess文件被Apache忽略。 确保将其设置为all 然后,重新启动服务器。 如果在本地一切正常,我可以肯定这是其中一个还是两个都是问题。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM