开发者

Website redirect

开发者 https://www.devze.com 2023-02-12 13:13 出处:网络
My question is quite simple. I have my main page (www.domain.com/index.php) Is there a way to redirect the user to /index.php when he only types www.domain.com?

My question is quite simple. I have my main page (www.domain.com/index.php)

  1. Is there a way to redirect the user to /index.php when he only types www.domain.com?

  2. And also remove the index.php from the url when he's on it?

I checked a bit about .htaccess, but none of the tricks seem to do the job.

Thank you!

EDIT

Here's my .htaccess:

# To set your custom php.ini, add the following line to this file:
# suphp_configpath /home/yourusername/path/to/php.ini

DirectoryInd开发者_JAVA技巧ex 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 :(


Simply put

DirectoryIndex index.php

in your .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


in the Domain control panel mention Start / Index page as index.php. Usually index.html/htm is the default page. 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]
0

精彩评论

暂无评论...
验证码 换一张
取 消