[英]Website redirect
My question is quite simple. 我的问题很简单。 I have my main page (www.domain.com/index.php)
我有我的主页(www.domain.com/index.php)
Is there a way to redirect the user to /index.php when he only types www.domain.com? 当用户仅键入www.domain.com时,是否可以将用户重定向到/index.php?
And also remove the index.php from the url when he's on it? 还可以从URL上删除index.php吗?
I checked a bit about .htaccess, but none of the tricks seem to do the job. 我检查了一些有关.htaccess的信息,但这些技巧似乎都不起作用。
Thank you! 谢谢!
EDIT 编辑
Here's my .htaccess: 这是我的.htaccess:
# To set your custom php.ini, add the following line to this file:
# suphp_configpath /home/yourusername/path/to/php.ini
DirectoryIndex index.php
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
<Files .htaccess>
order allow,deny
deny from all
</Files>
Options All -Indexes
As you can see, I put DirectoryIndex index.php in it, but doesn't change it :( 如您所见,我将DirectoryIndex index.php放入其中,但没有更改:(
Simply put 简单的说
DirectoryIndex index.php
in your .htaccess 在您的.htaccess中
When the user types www.domain.com it'll take index.php as default index page and won't be display in the address 用户输入www.domain.com时,它将使用index.php作为默认索引页面,并且不会显示在地址中
in the Domain control panel mention Start / Index page as index.php. 在域控制面板中,将“开始/索引”页面提到index.php。 Usually index.html/htm is the default page.
通常index.html / htm是默认页面。 You will find these option under site proerties.
您可以在站点属性下找到这些选项。
Redirect / http:/your.domain.php/index.php
RewriteEngine On
RewriteBase / # URL path corresponding to this directory
RewriteRule (^|.*/)index\.php$ $1 [R]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.