homepage Welcome to WebmasterWorld Guest from 54.167.185.110
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

    
301 for complete folder
tried it all
Solutions




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

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.

 

jd01




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

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]

Solutions




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

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

jdMorgan




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

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

Solutions




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

Thanks Jim,

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

Thanks again:-D

Solutions




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

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.

jdMorgan




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

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

Solutions




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

Thanks,

Forgot to refresh the cache...:-D

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved