Help with .htaccess file please

Alles, was den Apache betrifft, kann hier besprochen werden.

Help with .htaccess file please

Postby JKY » 25. December 2011 11:50

I've tried a few different ways of writing a .htaccess file, found online (eg http://devmoose.com/coding/20-htaccess-hacks-every-web-developer-should-know-about), but can't get them to do what I want. I'm no web developer, so need to some expert help...

I have a lot of folders at the root of my website, one of which contains my Wordpress site.

At the moment, I use meta refresh in the index.html file, eg http://www.mydomain.com/index.html, to take visitors to my wordpress site.

I've tried using .htaccess in the root folder, redirecting visitors from index.html file (http://www.mydomain.com/index.html) to the Wordpress folder, but it messes up the links to other folders, like my other blog, a folder and a subdomain.

Could someone tell me what I can put in the .htaccess file, please? I need it to ignore all folders and just take visitors that arrive at http://www.mydomain.com/. If they want to go to http://www.mydomain.com/another/folder/on/my/website/, then they're not going to get redirected to my Wordpress site.

Thanks.
JKY
 
Posts: 1
Joined: 25. December 2011 03:37
Operating System: Mac OS X

Re: Help with .htaccess file please

Postby vistangela » 16. January 2012 08:44

The Apache web server provides several way for setting up redirects.

The most simple one is using the “Redirect” directive. You want to Redirect index.html to a specific subfolder it can be accomplished by editing your htaccess and writing these rules:
Code: Select all
# This allows you to redirect index.html to a specific subfolder
Redirect /index.html http://example.com/newdirectory/


To redirect a specific index page you can use:

Code: Select all
# Provide Specific Index Page (Set the default handler)
DirectoryIndex index.html


I hope it serves your purpose.
vistangela
 
Posts: 1
Joined: 16. January 2012 08:21
Operating System: win 7


Return to Apache

Who is online

Users browsing this forum: No registered users and 12 guests