[英]PHP Bootstrap working perfectly on localhost but not working on VPS
I'm having a problem with my Bootstrap/PHP code working perfectly on XAMPP localhost but when I upload it to my /var/www folder with Apache and MySQL installed on the server, suddenly looks like .htaccess have problem. 我的Bootstrap / PHP代码在XAMPP本地主机上无法正常运行时遇到了问题,但是当我在服务器上安装了Apache和MySQL并将其上传到/ var / www文件夹时,突然看起来.htaccess出现了问题。 What should I do? 我该怎么办? Do I need to install something on my VPS like XAMPP? 我是否需要在VPS上安装XAMPP之类的东西? VPS has Linux Ubuntu Debian-7.0 (64 bit). VPS具有Linux Ubuntu Debian-7.0(64位)。
My .htaccess file: 我的.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]
If you have access to your Apache configuration, you will need to enable the mod_rewrite
Apache module as well as set the AllowOverride
option to all
. 如果您有权访问Apache配置,则需要启用mod_rewrite
Apache模块,并将AllowOverride
选项设置为all
。
mod_rewrite
is an Apache module that allows you to set rewrite rules for URLs. mod_rewrite
是一个Apache模块,允许您设置URL的重写规则。
AllowOverride
is typically set to none
by default, which will cause your htaccess file to be ignored by Apache. 通常,默认情况下, AllowOverride
通常设置为none
,这将导致htaccess文件被Apache忽略。 Make sure this is set to all
. 确保将其设置为all
。 Then, restart your server. 然后,重新启动服务器。 If everything was working fine locally, I am certain either or both of these are the issue. 如果在本地一切正常,我可以肯定这是其中一个还是两个都是问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.