Apache 从子域重写到.htaccess中的文件
此htaccess代码在旧服务器上正常工作,但在新服务器上完全可以工作,无需最后一次重写规则。将地址放入web explorer(例如sub.domain.com)后,它将加载index.php。可能是Apache设置错误造成的?还是别的 非常感谢Apache 从子域重写到.htaccess中的文件,apache,.htaccess,mod-rewrite,url-rewriting,Apache,.htaccess,Mod Rewrite,Url Rewriting,此htaccess代码在旧服务器上正常工作,但在新服务器上完全可以工作,无需最后一次重写规则。将地址放入web explorer(例如sub.domain.com)后,它将加载index.php。可能是Apache设置错误造成的?还是别的 非常感谢 RewriteEngine on RewriteBase / RewriteCond %{HTTP_HOST} ^domain\.com RewriteRule ^hra/([0-9]+)/?$ /game2.php?id=$1 [L,QSA]
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} ^domain\.com
RewriteRule ^hra/([0-9]+)/?$ /game2.php?id=$1 [L,QSA]
RewriteCond %{HTTP_HOST} ^sub\.domain\.com [NC]
RewriteRule ^$ /nacitanie.php [L]
启用站点中新服务器上的文件000-default.conf是启用htaccess的一部分:
<Directory /home/juraj/WWW>
Options FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
选项如下符号链接多视图
允许超越所有
命令允许,拒绝
通融
在新服务器上的apache.conf中,也是htaccess的一部分:
<Directory /home/juraj/WWW>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
选项索引跟随符号链接
允许超越所有
要求所有授权
错误发生在上次重写规则的情况下,在新服务器上的常规情况下,必须使用index.php添加选项
RewriteCond %{HTTP_HOST} "^sub\.domain\.com"
RewriteRule "^(index\.php|\?)$" "/nacitanie.php" [L,QSA]
错误发生在上次重写规则的情况下,在新服务器上的常规情况下,必须使用index.php添加选项
RewriteCond %{HTTP_HOST} "^sub\.domain\.com"
RewriteRule "^(index\.php|\?)$" "/nacitanie.php" [L,QSA]