我刚刚开始使用的.htaccess mod_rewrite
我发现自己难倒:如何将index.php重定向到index.php?route = home,并将其重写为/ home?
我建立基于查询字符串加载意见后index.php
的应用程序(使用MVC模式);例如。 domain.com/index.php?route=home
将加载主页。
然而,这意味着domain.com/index.php
没有查询字符串加载任何东西......或更多的加载点,domain.com
加载什么。
。 。 。
我想什么,是domain.com
(和domain.com/index.php
)
重定向到domain.com/index.php?route=home
,
,然后有domain.com/index.php?route=home
改写为domain.com/home
。
任何帮助,将不胜感激!谢谢。
我试过'RewriteEngine On'然后'RewriteRule /^(.*)/ index.php? route = $ 1 [L]',但在“http:// domain.com/home”中输入时显示“在此服务器上未找到请求的URL/home”。我还需要添加一个默认的查询字符串,而不仅仅是'domain.com/home'重定向。 – jlmakes
用于测试将'[L]'更改为'[R,L]'并告诉我地址栏上的网址是什么 – Ibu
RewriteRule ^(。*)index.php?route = $ 1 [L,QSA] this should追加查询字符串 –