Welcome to WebmasterWorld Guest from 174.129.151.95

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

301 for complete folder

tried it all

   
9:06 pm on Jul 13, 2005 (gmt 0)

10+ Year Member



I have accomplished rewrite of the problem with "with www and without www". I thought the next step would be easy for me - I was wrong.

I can't seem to work out how to redirect a all files under a specific folder to my root.

Example:

On my domain I have www.domain.com/subfolder (with a lot of pages in it).

I want users to go to my root everytime they go to .../subfolder/file.html (no matter what file the try to access)

Any suggestions? I know it's easy for some of you, but I have tried for days now.

9:23 pm on Jul 13, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi Solutions,

Could you post an example of what you have tried, so we can not only help you with the rewrite, but also show you where the error may be for future reference?

Please, also post what you mean by not working... do you mean server errors, page not found, or no redirect?

Justin

[edited by: jdMorgan at 1:32 am (utc) on July 14, 2005]
[edit reason] Speling. [/edit]

4:20 am on Jul 14, 2005 (gmt 0)

10+ Year Member



Hi Justin,

Among plenty other things I tried:

RewriteEngine On

RewriteRule ^http://www.mydomain.com/blog/(.*)$ [mydomain...] [R=301,L]

The above seems to do absolute nothing.

The above .htaccess is uploaded to the blog folder...thats right is it not?

/ Claus

4:45 am on Jul 14, 2005 (gmt 0)

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member



The correct syntax for use in your Web root ('home page') folder would be:

RewriteRule ^blog/(.*)$ http://www.example.com/$1 [R=301,L]

and if you want to put the code into the /blog/.htaccess file, then it would be:

RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]

You might want to take a look at the URL Rewriting Guide cited in our Forum Charter [webmasterworld.com].

Jim

1:02 pm on Jul 14, 2005 (gmt 0)

10+ Year Member



Thanks Jim,

I'll try it ater today when I get off work.

Thanks again:-D

4:52 pm on Jul 14, 2005 (gmt 0)

10+ Year Member



I'll be darned...

That did not work either.

Also I managed to screw up my allready working "no www" redirect to "www".

That was the most important thing I got fixed.

I am positive that my old .htaccess file looked like this:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^domain.com
RewriteRule (.*) [domain.com...] [R=301,L]

Doesn't that look allrigt to you guys? Anyay it does not seem to work anymore for some reason.

2:58 am on Jul 16, 2005 (gmt 0)

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member



1) You may need
Options +FollowSymLinks

ahead of your code.

2) Make sure you flush your browser cache (Temporary Internet Files) before testing each change.

3) Check your server error log if you get an error reported in the browser.

Jim

4:45 am on Jul 20, 2005 (gmt 0)

10+ Year Member



Thanks,

Forgot to refresh the cache...:-D