Greenguy's Board

Greenguy's Board (http://www.greenguysboard.com/board/index.php)
-   Programming & Scripting (http://www.greenguysboard.com/board/forumdisplay.php?f=15)
-   -   htaccess redirect root to sub folder (http://www.greenguysboard.com/board/showthread.php?t=59012)

Cleo 2010-09-20 02:12 PM

htaccess redirect root to sub folder
 
I found this on the web and it works without the www but with the www it goes into a redirect loop.

Code:

# .htaccess main domain to subfolder redirect

RewriteEngine on

# Change yourdomain.com to be your main domain.
RewriteCond %{HTTP_HOST} ^(www.)?clubkourtney.com$ [NC]

# Change 'subfolder' to be the folder you will use for your main domain.
RewriteCond %{REQUEST_URI} !^/blog/

# Don't change these lines.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

# Change 'subfolder' to be the folder you will use for your main domain.
RewriteRule ^(.*)$ /blog/$1 [L]

# Change yourdomain.com to be your main domain again.
# Change 'subfolder' to be the folder you will use for your main domain
# followed by / then the main file for your site, index.php, index.html, etc.
RewriteCond %{HTTP_HOST} ^(www.)?clubkourtney.com$ [NC]
RewriteRule ^(/)?$ blog/index.php [L]


Cleo 2010-09-20 02:49 PM

Never mind.

The above works just fine now that I've emptied my browser's cache.

Voltar 2010-09-20 08:12 PM

hehehe, been there done that :)

Cleo 2010-09-20 08:34 PM

I was just going to delete the thread but then decided to leave it in case someone else needs to do this sometime.

Voltar 2010-09-21 09:27 AM

yea, i'd say one out of every 3 newbies that i help end up doing it at some point..so it's fairly common...especially when you get into what you are doing and working away...so i'm for sure others have it happen to them on a regular basis..


All times are GMT -4. The time now is 03:34 PM.

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
© Greenguy Marketing Inc