简体   繁体   English

默认页面的htaccess问题

[英]Htaccess issue with default page

I have a dynamic page that links are ?p=home so for example mysite.com/?p=home Although with this, every page worked but the default home when you enter the site. 我有一个动态页面,该页面的链接是?p=home因此例如mysite.com/?p=home虽然这样做,但每个页面都可以工作,但进入网站时却是默认主页。

I then added: DirectoryIndex index.php?p=home to make it take me to the ?p=home by default, instead of going to index.php [which had no page on it]. 然后,我添加了: DirectoryIndex index.php?p=home ,默认情况下将其带到?p = home,而不是去index.php [上面没有页面]。 But now my home works but all the rest of the pages don't. 但是现在我的房子可以用了,但是其余所有页面都没有用。

Place this code in your DOCUMENT_ROOT/.htaccess file: 将此代码放在您的DOCUMENT_ROOT/.htaccess文件中:

RewriteEngine on

RewriteCond %{QUERY_STRING} ^$ [NC]
RewriteRule ^/?$ index.php?p=home [L]

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

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