删除index.php Htaccess
我正在尝试删除index.php并仍然保留一些查询信息。这就是我正在尝试使用的:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !(index.php) [NC]
RewriteRule ^(.*)$ vika-flyt.dk/index.php?rw=true [L]
这适用于我的其他网站之一,该网站托管在另一台服务器上。在它工作的域上,我必须使用类似这样的内容:
/home/web/domain_acount_name/domain.dk/index.php?rw=true
但我不知道该网站的“完整目录”链接。我认为这就是问题所在。
I'm trying to remove the index.php and still keep some query informations. This is what I'm trying to use:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !(index.php) [NC]
RewriteRule ^(.*)$ vika-flyt.dk/index.php?rw=true [L]
This works for one of my other sites, which is hosted on another server. On the domain where it is working, I have to use something like this:
/home/web/domain_acount_name/domain.dk/index.php?rw=true
But I don't know the "full-directory" link for this website. I think that's the problem.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
RewriteRules 在本地对您放置
.htaccess
的目录进行操作。通常,您根本不必在目标 URL 中包含域,除非您需要进行重定向。尝试将包含 RewriteRule 的行替换为:
如果这不起作用,您可能需要定义一个 RewriteBase 来告诉 mod_rewrite 您的 Web 应用程序所在的位置。 (例如,如果它不在
domain.com
而是在domain.com/app
,则需要将 RewriteBase 设置为app/
。)RewriteRules operate locally for the directory where you placed the
.htaccess
. And usually you don't have to include the domain at all in the target URL, except if you need to do a redirection.Try replacing the line containing the RewriteRule with this:
And if that doesn't work, you might need to define a RewriteBase to tell mod_rewrite where your webapplication is located. (For example if it's not at
domain.com
but rather atdomain.com/app
you need to set RewriteBase toapp/
.)