Welcome to WebmasterWorld Guest from 54.234.153.186

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

Redirect URLs with Question Marks

     

troyid

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

10+ Year Member



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

lucy24

3:52 pm on Jul 31, 2011 (gmt 0)

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



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.

g1smd

4:00 pm on Jul 31, 2011 (gmt 0)

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



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


The trailing question mark clears the query string.

srinuv

1:51 am on Aug 27, 2011 (gmt 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.

lucy24

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

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



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 ::

srinuv

5:08 am on Aug 27, 2011 (gmt 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.

g1smd

7:03 am on Aug 27, 2011 (gmt 0)

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



.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.

srinuv

7:25 am on Aug 27, 2011 (gmt 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.

g1smd

5:47 pm on Aug 27, 2011 (gmt 0)

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



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

Certain characters are reserved for specific purposes.

lucy24

9:20 pm on Aug 27, 2011 (gmt 0)

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



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

srinuv

3:24 am on Aug 29, 2011 (gmt 0)



Thank you for your suggestions.
 

Featured Threads

Hot Threads This Week

Hot Threads This Month