Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Ravens PHP Scripts And Web Hosting Forum Index -> RN v2.10.01 - All Issues
Author Message
utssace
Worker
Worker



Joined: Feb 18, 2006
Posts: 155
Location: Virginia

PostPosted: Sat Oct 13, 2007 3:03 pm Reply with quote

What is the best htaccess code to use to redirect the root to a subfolder.
My site is in a subfolder.

currently I have this:

Code:
# Turn on rewrites.

RewriteEngine on

# Only apply to URLs on this domain
RewriteCond %{HTTP_HOST} ^(www.)?domain.com$

# Only apply to URLs that aren't already under folder.
RewriteCond %{REQUEST_URI} !^/subfolder/

# Don't apply to URLs that go to existing files or folders.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

# Rewrite all those to insert /folder.
RewriteRule ^(.*)$ /subfolder/$1

# Also redirect the root folder.
RewriteCond %{HTTP_HOST} ^(www.)?domain.com$
RewriteRule ^(/)?$ subfolder/index.php [L]
 
View user's profile Send private message Visit poster's website
Raven
Site Admin/Owner



Joined: Aug 27, 2002
Posts: 17088

PostPosted: Sun Oct 14, 2007 2:33 pm Reply with quote

That should be more than enough. This might well suffice also.

Options +FollowSymlinks
RewriteEngine on
rewritecond %{http_host} ^(www.)?domain.com [nc]
rewriterule ^(.*)$ http://domain.com/subfolder/$1 [L, nc]
 
View user's profile Send private message
utssace







PostPosted: Sun Oct 14, 2007 7:51 pm Reply with quote

I got an Internal Server error with that code Raven. I am looking
for a simpler code like your suggestion.

The one I posted makes visits to the root domain redirect to the
subfolder but the URL just shows the root domain. However, it also allows
direct access to the subfolder index.
 
Raven







PostPosted: Sun Oct 14, 2007 10:00 pm Reply with quote

Remove this code. Not all hosts let you use it.

Options +FollowSymlinks
 
utssace







PostPosted: Mon Oct 15, 2007 6:29 am Reply with quote

Strange....even without that first line, I still get a 500 internal server error.
 
Raven







PostPosted: Mon Oct 15, 2007 7:09 am Reply with quote

Hmmm, try this:

Options +FollowSymlinks
RewriteEngine on
RewriteCond %{http_host} ^(www.)?domain.com [NC]
RewriteRule ^(.*)$ http://domain.com/subfolder/$1 [L]
 
utssace







PostPosted: Mon Oct 15, 2007 7:37 am Reply with quote

I tried that as well, same error.
 
montego
Site Admin



Joined: Aug 29, 2004
Posts: 9457
Location: Arizona

PostPosted: Tue Oct 16, 2007 5:06 am Reply with quote

Maybe this:

Options +FollowSymlinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www\.)?domain\.com [NC]
RewriteRule ^(.*)$ http://domain.com/subfolder/$1 [L]

[Edited: I upper cased the HTTP_HOST after-the-fact]

_________________
Only registered users can see links on this board! Get registered or login!
Only registered users can see links on this board! Get registered or login! 
View user's profile Send private message Visit poster's website
utssace







PostPosted: Tue Oct 16, 2007 6:34 am Reply with quote

The code I posted above works, but for some reason these snippets don't
I noticed the rewrite line looks different from what I posted above.
 
utssace







PostPosted: Sun Oct 21, 2007 8:12 am Reply with quote

A problem that I think may be caused by my use of the redirect code that
I posted above.

Recall that my site is in a subfolder. I am trying to use an htaccess redirect
in the root to point visitors to the site. In my root however, I have other
subfolders with private files in them. When I set password protection for
one the these other folders (using Direct Admin) I keep getting a 403
error when I point my browser to the protected folder. I am prompted
to enter the user/pasword for the folder but afterwards I get the 403 error.

It's the 403.html that is included in my nuke subfolder. I do not have
a 403.html in my root.

I am just wondering if this redirect code it throwing off my call to other folder
in my root.

Any ideas?
 
Display posts from previous:       
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Ravens PHP Scripts And Web Hosting Forum Index -> RN v2.10.01 - All Issues

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©