我对这个问题感到困惑了几天。使用Clean URL时,所有.html页面都会重定向到主页。静态和动态生成的页面都会发生这种情况。但是,所有.php页面都能正常工作。我正在使用以下.htaccess,我在域上运行SSL。
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
此信息来自原始安装,以及多个在线来源。我无论如何都不是专家,可以真正使用一些帮助。其中大部分对我来说都是陌生的。
有什么建议吗? 谢谢!
答案 0 :(得分:0)
试试这个。
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP:Authorization} ^(.*)
RewriteRule .* - [e=HTTP_AUTHORIZATION:%1]
RewriteRule (^|/)\. - [F]
# Admin.php redirect rules.
# Uncomment underlaying lines and replace <new_admin> with your path to admin.php.
# Any requests to <new_admin>.php will be redirected to the real admin.php file.
# RewriteCond %{ENV:REDIRECT_STATUS} ^$
# RewriteRule ^admin\.php(.*)$ - [NS,NC,L,R=404]
# RewriteRule ^<new_admin>\.php(.*)$ admin.php$1 [NC,L,QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^sitemap.xml(\?.+)?$ cart.php?target=sitemap [NC,L,QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^((([/_a-z0-9-]+)/)?([_a-z0-9-]+)/)?([_a-z0-9-]+)(/?)(\.([_a-z0-9-]+))?$ cart.php?url=$5&last=$4&rest=$3&ext=$7 [NC,L,QSA]
RewriteBase /
</IfModule>
答案 1 :(得分:0)
请查看原始.htaccess: https://raw.githubusercontent.com/xcart/xcart5/master/src/.htaccess
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^((([/_a-z0-9-]+)/)?([_a-z0-9-]+)/)?([_a-z0-9-]+)(/?)(\.([_a-z0-9-]+))?$ cart.php?url=$5&last=$4&rest=$3&ext=$7 [NC,L,QSA]