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

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

Apache Web Server Forum

    
301 Redirect Entire 'Dynamic' Folder To One File.
....the "?" is causing me issues.
sandpetra

10+ Year Member



 
Msg#: 3526439 posted 3:29 am on Dec 13, 2007 (gmt 0)

I'm trying to redirect an entire folder to one file but the "?" seems to be causing issues.

It redirects to the desired file,but with the variables. I want to obviously get rid of this. Any help?

 

jdMorgan

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



 
Msg#: 3526439 posted 3:53 am on Dec 13, 2007 (gmt 0)

The most common reason is that query strings pass through RewriteRules untouched.

Add a question mark to the end of your destination URL to clear the query string -- See the Apache RewriteRule documentation.

Jim

phranque

WebmasterWorld Administrator phranque us a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



 
Msg#: 3526439 posted 3:55 am on Dec 13, 2007 (gmt 0)

you probably need to do a permanent external redirect.
it is hard to answer specifically and correctly without more information, but you should end up with something like this in general:
RewriteRule (.*) http://www.example.com/$1? [R=301,L]

(after referring to the apache doc, it appears this may work for internal rewrites as well.)

sandpetra

10+ Year Member



 
Msg#: 3526439 posted 4:10 am on Dec 13, 2007 (gmt 0)

I'm trying to redirect:

".....web-directory/index.php?c=7"

"and everything else in that directory to

"....file.htm"

on my other site.

Normally 301 works no problem on the server.

phranque

WebmasterWorld Administrator phranque us a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



 
Msg#: 3526439 posted 4:13 am on Dec 13, 2007 (gmt 0)

please post the relevant rewrite code and what results you saw.

g1smd

WebmasterWorld Senior Member g1smd us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 3526439 posted 11:17 pm on Dec 16, 2007 (gmt 0)

You will end up with something like:

RewriteRule ^webdirectory http://www.example.com/file.htm? [R=301,L]

The ? is important.

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