我已经将一个站点从现场(工作正常)复制到我的本地机器上。在本地我可以查看我的网站主页,但是如果我尝试访问另一个页面,我会不断收到 404。
这是我的虚拟主机设置:
<VirtualHost *:80>
DocumentRoot "C:\Users\Sony\Documents\websites\website.com"
ServerName local.website.com
<Directory "C:\Users\Sony\Documents\websites\website.com">
Order allow,deny
Allow from all
Require all granted
</Directory>
</VirtualHost>
任何人都知道为什么会发生这种情况?似乎只发生在最新版本的 xampp 和已重写的 url 上。
如果您对此感兴趣,请查看我的 htaccess 文件:
ErrorDocument 404 /404.php
RewriteEngine on
RewriteBase /
# remove www from host
RewriteCond %{HTTP_HOST} ^www\.(.+)
RewriteCond %{HTTPS}s/%1 ^(on(s)|offs)/(.+)
RewriteRule ^ http%2://%3%{REQUEST_URI} [L,R=301]
# remove trailing slash
RewriteRule ^(.*)\/(\?.*)?$ $1$2 [R=301,L]
# Don't match real existing files so CSS, scripts, images aren't rewritten
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Match the first two groups before / and send them to the query string
RewriteRule ^([+A-Za-z0-9-\.]+)?$ deals.php?country_code=$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([+A-Za-z0-9-\.]+)/([+A-Za-z0-9-\.]+)?$ deals.php?country_code=$1&zone_id=$2 [L]
任何帮助,将不胜感激