简体   繁体   English

HTAccess 重写规则影响其他页面?

[英]HTAccess Rewrite rule affecting other pages?

I've just created a rule for my .htaccess file to send any traffic going to...我刚刚为我的 .htaccess 文件创建了一个规则,以将任何流量发送到...

mysite.com/area-scheme.php?scheme_id=XXX to appear as mysite.com/london mysite.com/area-scheme.php?scheme_id=XXX显示为mysite.com/london

The below works fine for those pages, but if I visit mysite.com, its not loading data correctly and I have to actually visit mysite.com/index.php, have I done something wrong?下面的内容适用于这些页面,但如果我访问 mysite.com,它没有正确加载数据,我必须实际访问 mysite.com/index.php,我做错了什么吗?

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]*)$ /area-scheme.php?scheme_id=$1 [L]

can you try this?你能试试这个吗?

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)$ /area-scheme.php?scheme_id=$1 [L]

This may avoid rewriting mysite.com that has an empty relative URL.这可以避免重写具有空的相对 URL 的 mysite.com。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM