.htaccess重写不能在新服务器上运行

时间:2014-01-06 16:23:08

标签: .htaccess

我刚刚将一个网站转移到一个新服务器,现在.htaccess文件重定向似乎不起作用。请参阅下面的示例:

# .htaccess

#Rewrite rules
RewriteEngine on
Options +FollowSymlinks
RewriteBase /weddings/

RewriteRule ^facilities facilities.php [NC]

RewriteRule ^catering catering.php [NC]
RewriteRule ^gallery/([^/]+) ../general/gallery.php?gal=$1 [NC]
RewriteRule ^gallery ../general/gallery.php [NC]
RewriteRule ^location ../general/location.php [NC]
RewriteRule ^floor_plans ../general/floor_plans.php [NC]
RewriteRule ^testimonials ../general/testimonials.php [NC]
RewriteRule ^prices ../general/prices.php [NC]
RewriteRule ^parking ../general/parking.php [NC]
RewriteRule ^accommodation ../general/accommodation.php [NC]

为什么会这样做的任何建议?

由于

1 个答案:

答案 0 :(得分:0)

确保您已启用.htaccess。在Apache配置中的某个地方,你应该有

AllowOverride All

还要确保已安装并启用mod_rewrite。在Debian中,符号链接/etc/apache2/mod-enabled/rewrite.load应指向../mods_available/rewrite.load。否则请参阅How to enable mod_rewrite for Apache 2.2