我设置了一个虚拟主机,并在 htaccess 中放入了一些重写规则...但它们不起作用...只有虚拟主机配置中的规则有效..我做错了什么?
.htaccess
setEnv TZ Europe/Athens
Options +FollowSymLinks
ErrorDocument 404 /404.php
php_value max_execution_time 600
php_value max_input_time 600
php_value upload_max_filesize 10M
php_value post_max_size 16M
php_value memory_limit 200M
php_value session.gc_maxlifetime 21600
php_flag magic_quotes_gpc Off
RewriteEngine On
RewriteBase /
RewriteRule ^(.+)/home/?$ /index.php?__i18n_language=$1 [L]
RewriteRule ^(.+)/press/([0-9]+)?$ /press.php?__i18n_language=$1&id=$2 [L]
RewriteRule ^(.+)/profile/(.+)?$ /static.php?__i18n_language=$1&tag=$2 [L]
RewriteRule ^(.+)/links/?$ /static.php?__i18n_language=$1&tag=links [L]
RewriteRule ^(.+)/corporate/?$ /static.php?__i18n_language=$1&tag=corporate [L]
RewriteRule ^(.+)/products/?$ /static.php?__i18n_language=$1&tag=products [L]
RewriteRule ^(.+)/products/(.+)?$ /static.php?__i18n_language=$1&tag=$2 [L]
RewriteRule ^(.+)/press/?$ /press.php?__i18n_language=$1 [L]
RewriteRule ^(.+)/sitemap/?$ /sitemap.php?__i18n_language=$1 [L]
RewriteRule ^(.+)/financial/?$ /financial.php?__i18n_language=$1 [L]
RewriteRule ^(.+)/contact/?$ /static.php?__i18n_language=$1&tag=contact [L]
RewriteRule ^(.+)/newsletter/?$ /newsletter.php?__i18n_language=$1 [L]
虚拟主机文件
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName dev.skiandboard.gr
DocumentRoot "C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\ski\content"
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
ErrorLog "C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\ski\error.log"
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
RewriteEngine On
RewriteRule ^/(.+)/cat/(.+)/([0-9]+)/?$ /category.php?__i18n_language=$1&category_tag=$2&page=$3 [L]
RewriteRule ^/(.+)/cat/(.+)?$ /category.php?__i18n_language=$1&category_tag=$2&page=1 [L]
RewriteRule ^(.+)/prd/?$ /product.php?__i18n_language=$1&product_tag=$2 [L]
RewriteRule ^(.+)/static/(.+)/?$ /static.php?__i18n_language=$1&page_tag=$2 [L]
</VirtualHost>
答案1
查看“error.log”和“access.log”文件。当您访问某个页面时会出现哪些行?
答案2
问题解决了...看来 htaccess 中的重写规则在开始时不需要 /...很奇怪..