我的Bootstrap / PHP代码在XAMPP localhost上完美运行时遇到问题但是当我将它上传到我的/ var / www文件夹时,服务器上安装了Apache和MySQL,突然看起来像.htaccess有问题。我该怎么办?我是否需要在像XAMPP这样的VPS上安装一些东西? 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]
答案 0 :(得分:0)
如果您有权访问Apache配置,则需要启用mod_rewrite
Apache模块,并将AllowOverride
选项设置为all
。
mod_rewrite
是一个Apache模块,允许您为URL设置重写规则。
AllowOverride
通常设置为none
,这将导致Apache忽略您的htaccess文件。确保将其设置为all
。然后,重新启动服务器。如果一切都在当地运作良好,我肯定其中一个或两个都是问题。