/    Sign up×
Community /Pin to ProfileBookmark

No index.html as homepage

Hi,
I don’t want index.html to be loaded if someone goes to my site. Like test.com (is actually: test.com/index.html)
I want if you go to test.com (test.com/application/models/index.php) loads.
What should I change in my htacces file?

I know the easy solution is to have my index.html auto redirect to that location, but I think that’s not the most efficient way.

Thanks in common,
David

to post a comment
Full-stack Developer

3 Comments(s)

Copy linkTweet thisAlerts:
@cbVisionOct 29.2012 — I think you'll want something like this:

[CODE]
RedirectMatch permanent ^/$ http://www.test.com/application/models
[/CODE]


If that doesn't work, you'll want to try Googling for "change directory root htaccess."
Copy linkTweet thisAlerts:
@Major_PayneOct 30.2012 — You could set up an .htaccess rewrite condition, but actually "test.com/index.html" is not the same path as "test.com/application/models/index.php". If you want "test.com/index.html" to go to "test.com/application/models/index.php", the use the .htaccess file or try a 301 Redirect.
Copy linkTweet thisAlerts:
@abiabiahNov 02.2012 — You will need to have .htaccess file for url rewriting. A simple line of code below with redirect URL as per your needs:

Options +FollowSymLinks

DirectoryIndex index.php

RewriteEngine On

RewriteBase /

RewriteCond %{THE_REQUEST} ^[A-Z]{3,9} /index.php HTTP/

RewriteRule ^index.php$ http://www.askapache.com/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule . /index.php [L][/QUOTE]
×

Success!

Help @DavidBonting spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...