Welcome to WebmasterWorld Guest from 54.162.152.232

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

Redirect URLs with Question Marks

     
1:15 pm on Jul 31, 2011 (gmt 0)

Junior Member

10+ Year Member

joined:Oct 30, 2002
posts: 89
votes: 0


I want to redirect a subdomain and all urls to my root domain. e.g. cgi.example.com to www.example.com

I currently have this.

RedirectMatch 301 (.*) http://www.example.com/

My problem is that I have a number of URLs with question marks.

e.g. [cgi.example.com...]

These urls are redirecting to http://www.example.com/?ringid=test;siteid=vincentvds instead of what I want which is http://www.example.com
3:52 pm on July 31, 2011 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month

joined:Apr 9, 2011
posts:14140
votes: 537


I don't think you can do it with mod_alias ("Redirect" as opposed to "Rewrite"). If you change it to a rewrite [httpd.apache.org], just stick a naked ? at the end and it will strip away any existing query strings.
4:00 pm on July 31, 2011 (gmt 0)

Senior Member

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:July 3, 2002
posts:18903
votes: 0


RewriteRule ^requested-path http://www.example.com/new-path? [R=301,L]


The trailing question mark clears the query string.
1:51 am on Aug 27, 2011 (gmt 0)

New User

5+ Year Member

joined:Aug 27, 2011
posts:5
votes: 0


Hi,

I am new to Apache config..I have similar problem but in a different way..I have site urls like
[url]www.example.com/SampleSite/Which Terminal?[/url]

I have rewrite rule like this

RewriteRule ^/(.*)$ www.exmaple.com/SampleSite/$1 [L,PT]


what is happening is..apache not sending "?" character to server..so server not able to resolve the URL..

I have verified apache rewrite logs..below part is coming

split uri=www.example.com/SampleSite/Which Terminal? -> uri=www.example.com/SampleSite/Which Terminal, args=<none>


How can I make sure that "?" will also be passed to server without truncating from apache? please suggest me..

Thank you.
2:57 am on Aug 27, 2011 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month

joined:Apr 9, 2011
posts:14140
votes: 537


Oh, ###. Do you mean that your url contains a literal question mark? It's not the beginning of a query string, but part of the actual filename?

:: staggering off to lie down with cold compress on forehead ::
5:08 am on Aug 27, 2011 (gmt 0)

New User

5+ Year Member

joined:Aug 27, 2011
posts: 5
votes: 0


Yes Lucy, my website has few URLs like that. And my client testing by creating different URLs for testing my application..like SampleSite/test-?-@ like this..if "?" appears..apache splitting URL into two parts and sending second argument as parameter...

How can I tell Apache don't do this? please help me on that.
7:03 am on Aug 27, 2011 (gmt 0)

Senior Member

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:July 3, 2002
posts:18903
votes: 0


.if "?" appears..apache splitting URL into two parts and sending second argument as parameter
Apache is working exactly as it should.

The question mark is a "reserved" character in the HTTP specification. It is the path to query string delimiter.

Also reserved are colon and slash. Don't break the HTTP specs.
7:25 am on Aug 27, 2011 (gmt 0)

New User

5+ Year Member

joined:Aug 27, 2011
posts: 5
votes: 0


Actually the request coming in UTF-8 encoded format like /SampleSite/Which Terminal%3F..but still apache considering it as "?" and splitting it..can't we use "?" in url other than query parameters?
Please let me know your comments.
5:47 pm on Aug 27, 2011 (gmt 0)

Senior Member

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:July 3, 2002
posts:18903
votes: 0


You are not free to put any character you like in a URL.

Certain characters are reserved for specific purposes.
9:20 pm on Aug 27, 2011 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month

joined:Apr 9, 2011
posts:14140
votes: 537


It occurs to me that you (or your bosses) may be confusing the file name with the page title. The filename is seen only by computers (and by people who study the exact content of the browser's address bar). The title is the text that appears at the top of the window. It's basically just a special category of content and can be almost anything, provided it isn't too long and you've dealt with file encoding.

Something like <title = "Which Terminal?"> is perfectly fine ... so long as the file it's attached to is called, say, which_terminal.html
3:24 am on Aug 29, 2011 (gmt 0)

New User

5+ Year Member

joined:Aug 27, 2011
posts: 5
votes: 0


Thank you for your suggestions.
 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members