Forum Moderators: phranque

Message Too Old, No Replies

Problem with redirect

.htaccess with html folder

         

Shrike99

3:34 pm on Nov 26, 2005 (gmt 0)

10+ Year Member



Hi!

I contacted the support of my hosting company and they provided me with this .htaccess to do a redirect:

RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} ^example\.com
RewriteRule ^(.*) http://www.example.com/$1 [R=301,L]

Obviously, if I'm asking for your help it is because it does not work correctly...

On my host though, my html files are by default in the .html folder, which seem to cause the problem.
So when I uploaded the .htaccess, I did a test and http://example.com/abc.html was redirected to http://www.example.com/html/abc.html , which of course gives me a "Page not found".

Any idea how to modify my .htaccessto make it work with this "html" folder?

Thanks!

Shrike99

jdMorgan

4:25 pm on Nov 26, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Try changing the RewriteBase [httpd.apache.org]:

RewriteBase /html/

JIm

Shrike99

5:11 pm on Nov 26, 2005 (gmt 0)

10+ Year Member



Jim,

I tried the :
RewriteBase /html/
instead of the
RewriteBase /

It gets worst, I get http://www.example.com/html/html/abc.html

So now there's 2 "html" when I want none.

Interesting, the problem might be with that "RewriteBase" line...

Shrike99

Shrike99

3:44 pm on Nov 28, 2005 (gmt 0)

10+ Year Member



AH!

Got it!

I just had tu put my .htaccess file in my html directory! I should have think about it before...

So simple, it seems to work fine!

Thanks.

Shrike99