homepage Welcome to WebmasterWorld Guest from 54.227.12.4
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

This 42 message thread spans 2 pages: < < 42 ( 1 [2]     
Rewrite Dynamic Query String URL to Subdomain
Need to Rewrite Query String and 301 to Subdomain
ItsDavid




msg:4548745
 5:44 pm on Feb 25, 2013 (gmt 0)

Hi, I have finally given in and decided to ask here because my days are passing me by and i am not making any progress. I have been searching the internet for days trying to find answers related to my questions with very minimum results to my situation.

Before i get started with my questions i just want to add that i do have wildcard domains setup and working properly on my site and i also have a sub.domain.com setup in my cpanel for this exact url in question that points to the main sites root folder. So with that said Here We Go!


My current dynamic url structure is currently like this

index.php?a=11&b=$2&c=65&d=3


all urls must make the call to index.php

Now what i am trying to do is take this exact url below

index.php?a=4


and display it as a sub.domain.com which currently only works if i comment out the RewriteCond %{QUERY_STRING} ^a=4$ [NC]part of the rewrite rule. however when i go to the address sub.domain.com i am getting the following message in my browser.

The page isn't redirecting properly
Firefox has detected that the server is redirecting the request for this address in a way that will never complete.


Here is the code i am currently using to try to accomplish this.

RewriteCond %{HTTP_HOST} ^sub.domain.com? [NC]
RewriteCond %{REQUEST_URI} !^/accounts/.* [NC]
RewriteCond %{QUERY_STRING} ^a=4$ [NC]
RewriteRule ^/?index\.php$ http://sub\.domain.com? [L]


Now because this is a dynamic query string url i have to make two rewrite rules and this current 301 rewrite rule i have keeps crashing my server, why i don't know but every time i try different things to get the rule to work my server goes haywire but i don't get any messages in my browser like i do with the other code above. Here is the 301 rewrite i am trying to use but to no avail.

# Redirect Direct Client Requests For Account Dynamic URL to Static Equivalent Subdomain
RewriteCond %{QUERY_STRING} ^a=4$ [NC]
RewriteRule ^index\.php$ http://sub.domain.com? [R=301,L]


I need these rules to be exact matches specific to the sub.domain.com because i tried running it as a wildcard and it breaks my other wildcard subdomains that are currently setup for states and cities.

I have one other question as well that i would like to ask the experts here. The code below has nothing to do with the subdomain question as it is working fine however if you could just take a look at it and share your thoughts on it's structure? I am just curious if there is anything that can be done to make it better?

# Redirect Direct Client Requests For About Us Dynamic URL to Static Equivalent
RewriteCond %{THE_REQUEST} ^a=28&b=142$
RewriteRule ^index\.php$ http://wantadmag.com/about? [R=301,L]

RewriteRule ^about$ index.php?a=28&b=142 [L] ## About Us URL


Thank you all in advance for any help you can provide.

 

ItsDavid




msg:4549500
 4:42 pm on Feb 27, 2013 (gmt 0)

I played around with it a little and made the following changes and now when i click on the original link http://example.com/index.php?a=4 it does take me to [accounts.example.com...] displaying in the browser however i am getting a 404 Not Found The requested URL /example.com/index.php was not found on this server.

Here is the code with the edits i have made

# Redirect
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /(index\.php)?\?a=4\ HTTP/
RewriteRule ^(index\.php)?$ [accounts.wantadmag.com...] [R=301,L]

#Rewrite
RewriteCond %{HTTP_HOST} ^accounts\.wantadmag\.com$
RewriteRule ^$ wantadmag\.com/index\.php\?a=4 [L]

ItsDavid




msg:4549536
 6:25 pm on Feb 27, 2013 (gmt 0)

I played around with it a little and made the following changes and now when i click on the original link http://example.com/index.php?a=4 it does take me to [accounts.example.com...] displaying in the browser however i am getting a 404 Not Found The requested URL /example.com/index.php was not found on this server.

Here is the code with the edits i have made

# Redirect
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /(index\.php)?\?a=4\ HTTP/
RewriteRule ^(index\.php)?$ [accounts.example.com...] [R=301,L]

#Rewrite
RewriteCond %{HTTP_HOST} ^accounts\.example\.com$
RewriteRule ^$ wantadmag\.com/index\.php\?a=4 [L]

g1smd




msg:4549547
 7:01 pm on Feb 27, 2013 (gmt 0)

when I click the link http://example.com/index.php?a=4

You shouldn't be linking to that URL any more. The redirect is there for people following stale search engine listings or recalling a URL stored in bookmarks. The site should link to the URL that you want users to see and use.

The fact that you the browser tries to load example.com points to another rule interfering with this one, probably your main non-www to www rule for which you will need to add an exclusion to NOT redirect requests for the accounts subdomain.

ItsDavid




msg:4549551
 7:14 pm on Feb 27, 2013 (gmt 0)

I used that link to test and see if it would actually redirect me to the new [accounts.example.com...] rewrite and it doesn't it just forwards me to the home page http://example.com

as for the non-www to www. That is working correctly because i have it setup to remove www from home page and sub domains and it is removing it from all of my domains.

I am thinking it may have to do with the query string not getting carried over because the 404 only specifies index.php cannot be found which i can understand being the case because my index.php file is not directly accessible for viewing as it is the main controller that serves the pages and content depending on the query string added behind it.

ItsDavid




msg:4549558
 7:28 pm on Feb 27, 2013 (gmt 0)

Ok i found the source of the problem.

The problem was that i had created the sub domain "accounts" in cpanel and pointed it at the root of the site then once i add the rewrite rule to my .htaccess cPanel then adds a redirect of /index.php?a=4 for my accounts sub domain.

I removed the "accounts" sub domain from cPanel cleared all cache the tried the rewrite / redirect rule again and it is working correctly except that i am getting these messages from my browsers.

Chrome: Error 310 (net::ERR_TOO_MANY_REDIRECTS): There were too many redirects.

FireFox: The page isn't redirecting properly
Firefox has detected that the server is redirecting the request for this address in a way that will never complete.

and Safari is giving me the same message so now i just have to figure out how to stop the looping.

g1smd




msg:4549569
 7:41 pm on Feb 27, 2013 (gmt 0)

You now have an infinite loop.

You'll need to use the Live HTTP Headers extension for Firefox to see what is happening.

ItsDavid




msg:4549578
 8:05 pm on Feb 27, 2013 (gmt 0)

It did not do the infinite loop message again but this is the information i got from Live HTTP Headers

[accounts.example.com...]

GET / HTTP/1.1
Host: accounts.example.com
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:19.0) Gecko/20100101 Firefox/19.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Cookie: session=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Connection: keep-alive

HTTP/1.1 302 Moved Temporarily
Date: Wed, 27 Feb 2013 19:57:54 GMT
Server: Apache
x-powered-by: PHP/5.2.11
Cache-Control: no-cache, must-revalidate
Expires: Sat, 26 Jul 1997 05:00:00 GMT
Location: http://example.com/index.php
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Length: 20
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: text/html

g1smd




msg:4549610
 9:42 pm on Feb 27, 2013 (gmt 0)

You have another rule that is interfering with the operation.

You'll need to either add an exclusion to that rule or modify it in some other way.

ItsDavid




msg:4549613
 10:29 pm on Feb 27, 2013 (gmt 0)

I have this rule in there to remove index.php from any home directory however it does not remove it from any other urls.

# Redirect index.php Requests (Prevent Site Showing index.php in Browser Address Bar)
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/
RewriteRule ^index\.php$ [%{HTTP_HOST}...] [R=301,NS,L]


I tried removing the code above but didn't have any luck.

I don't know if this information is of any help but if i leave "example" in the code you provided and click on a url with index.php?a=4 it forwards to [accounts.example.com...] without a problem i just get a message in firefox that say's

Server not found
Firefox can't find the server at accounts.example.com.

I also tried removing all .htaccess rules except for the one in question and the only thing happening when i click the link it that it just reloads to the home page http://example.com

g1smd




msg:4549615
 11:04 pm on Feb 27, 2013 (gmt 0)

"Server not found" means either the DNS is b0rked or the server config doesn't define the subdomain.

There's some other problem preventing the other part working.

ItsDavid




msg:4549626
 11:41 pm on Feb 27, 2013 (gmt 0)

First i want to say thank you so much for all this help you are providing. There is just something inside me that say's the problem is right in front of my eyes but i just can't seem to nail it.

after some playing around this is what i have now.


i have changed the code to this below


#Redirect
RewriteCond %{QUERY_STRING} ^a{1}=4{1}$ [NC]
RewriteRule ^index\.php$ [accounts.wantadmag.com?...] [R=301,L]

#Rewrite
RewriteCond %{HTTP_HOST} ^accounts\.wantadmag\.com$
RewriteRule ^$ /index.php?a=4 [L]


This code above is redirecting and taking me to [accounts.example.com...] when i click http://example.com the only problem is that i am getting the infinite loop message again from FireFox

The page isn't redirecting properly
Firefox has detected that the server is redirecting the request for this address in a way that will never complete.


Here is the log from Live HTTP Headers. I don't know if the full list is needed but i am just going to add it in case it's more help to have see it.



http://example.com/index.php?a=4

GET /index.php?a=4 HTTP/1.1
Host: example.com
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:19.0) Gecko/20100101 Firefox/19.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: http://example.com/
Cookie: session=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Connection: keep-alive

HTTP/1.1 301 Moved Permanently
Date: Wed, 27 Feb 2013 23:34:05 GMT
Server: Apache
Location: [accounts.example.com...]
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Length: 195
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: text/html; charset=iso-8859-1
----------------------------------------------------------
[accounts.example.com...]

GET / HTTP/1.1
Host: accounts.example.com
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:19.0) Gecko/20100101 Firefox/19.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: http://example.com/
Cookie: session=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Connection: keep-alive

HTTP/1.1 301 Moved Permanently
Date: Wed, 27 Feb 2013 23:34:06 GMT
Server: Apache
Location: [accounts.example.com...]
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Length: 195
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: text/html; charset=iso-8859-1
----------------------------------------------------------
[accounts.example.com...]

GET / HTTP/1.1
Host: accounts.example.com
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:19.0) Gecko/20100101 Firefox/19.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: http://example.com/
Cookie: session=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Connection: keep-alive

HTTP/1.1 301 Moved Permanently
Date: Wed, 27 Feb 2013 23:34:06 GMT
Server: Apache
Location: [accounts.example.com...]
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Length: 195
Keep-Alive: timeout=5, max=99
Connection: Keep-Alive
Content-Type: text/html; charset=iso-8859-1
----------------------------------------------------------
[accounts.example.com...]

GET / HTTP/1.1
Host: accounts.example.com
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:19.0) Gecko/20100101 Firefox/19.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: http://example.com/
Cookie: session=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Connection: keep-alive

HTTP/1.1 301 Moved Permanently
Date: Wed, 27 Feb 2013 23:34:06 GMT
Server: Apache
Location: [accounts.example.com...]
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Length: 195
Keep-Alive: timeout=5, max=98
Connection: Keep-Alive
Content-Type: text/html; charset=iso-8859-1
----------------------------------------------------------
[accounts.example.com...]

GET / HTTP/1.1
Host: accounts.example.com
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:19.0) Gecko/20100101 Firefox/19.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: http://example.com/
Cookie: session=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Connection: keep-alive

HTTP/1.1 301 Moved Permanently
Date: Wed, 27 Feb 2013 23:34:06 GMT
Server: Apache
Location: [accounts.example.com...]
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Length: 195
Keep-Alive: timeout=5, max=97
Connection: Keep-Alive
Content-Type: text/html; charset=iso-8859-1
----------------------------------------------------------
[accounts.example.com...]

GET / HTTP/1.1
Host: accounts.example.com
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:19.0) Gecko/20100101 Firefox/19.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: http://example.com/
Cookie: session=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Connection: keep-alive

HTTP/1.1 301 Moved Permanently
Date: Wed, 27 Feb 2013 23:34:06 GMT
Server: Apache
Location: [accounts.example.com...]
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Length: 195
Keep-Alive: timeout=5, max=96
Connection: Keep-Alive
Content-Type: text/html; charset=iso-8859-1
----------------------------------------------------------
[accounts.example.com...]

GET / HTTP/1.1
Host: accounts.example.com
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:19.0) Gecko/20100101 Firefox/19.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: http://example.com/
Cookie: session=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Connection: keep-alive

HTTP/1.1 301 Moved Permanently
Date: Wed, 27 Feb 2013 23:34:06 GMT
Server: Apache
Location: [accounts.example.com...]
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Length: 195
Keep-Alive: timeout=5, max=95
Connection: Keep-Alive
Content-Type: text/html; charset=iso-8859-1
----------------------------------------------------------
[accounts.example.com...]

GET / HTTP/1.1
Host: accounts.example.com
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:19.0) Gecko/20100101 Firefox/19.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: http://example.com/
Cookie: session=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Connection: keep-alive

HTTP/1.1 301 Moved Permanently
Date: Wed, 27 Feb 2013 23:34:06 GMT
Server: Apache
Location: [accounts.example.com...]
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Length: 195
Keep-Alive: timeout=5, max=94
Connection: Keep-Alive
Content-Type: text/html; charset=iso-8859-1
----------------------------------------------------------
[accounts.example.com...]

GET / HTTP/1.1
Host: accounts.example.com
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:19.0) Gecko/20100101 Firefox/19.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: http://example.com/
Cookie: session=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Connection: keep-alive

HTTP/1.1 301 Moved Permanently
Date: Wed, 27 Feb 2013 23:34:06 GMT
Server: Apache
Location: [accounts.example.com...]
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Length: 195
Keep-Alive: timeout=5, max=93
Connection: Keep-Alive
Content-Type: text/html; charset=iso-8859-1
----------------------------------------------------------
[accounts.example.com...]

GET / HTTP/1.1
Host: accounts.example.com
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:19.0) Gecko/20100101 Firefox/19.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: http://example.com/
Cookie: session=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Connection: keep-alive

HTTP/1.1 301 Moved Permanently
Date: Wed, 27 Feb 2013 23:34:06 GMT
Server: Apache
Location: [accounts.example.com...]
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Length: 195
Keep-Alive: timeout=5, max=92
Connection: Keep-Alive
Content-Type: text/html; charset=iso-8859-1
----------------------------------------------------------
[accounts.example.com...]

GET / HTTP/1.1
Host: accounts.example.com
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:19.0) Gecko/20100101 Firefox/19.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: http://example.com/
Cookie: session=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Connection: keep-alive

HTTP/1.1 301 Moved Permanently
Date: Wed, 27 Feb 2013 23:34:06 GMT
Server: Apache
Location: [accounts.example.com...]
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Length: 195
Keep-Alive: timeout=5, max=91
Connection: Keep-Alive
Content-Type: text/html; charset=iso-8859-1
----------------------------------------------------------
[accounts.example.com...]

GET / HTTP/1.1
Host: accounts.example.com
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:19.0) Gecko/20100101 Firefox/19.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: http://example.com/
Cookie: session=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Connection: keep-alive

HTTP/1.1 301 Moved Permanently
Date: Wed, 27 Feb 2013 23:34:06 GMT
Server: Apache
Location: [accounts.example.com...]
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Length: 195
Keep-Alive: timeout=5, max=90
Connection: Keep-Alive
Content-Type: text/html; charset=iso-8859-1
----------------------------------------------------------
[accounts.example.com...]

GET / HTTP/1.1
Host: accounts.example.com
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:19.0) Gecko/20100101 Firefox/19.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: http://example.com/
Cookie: session=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Connection: keep-alive

HTTP/1.1 301 Moved Permanently
Date: Wed, 27 Feb 2013 23:34:07 GMT
Server: Apache
Location: [accounts.example.com...]
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Length: 195
Keep-Alive: timeout=5, max=89
Connection: Keep-Alive
Content-Type: text/html; charset=iso-8859-1
----------------------------------------------------------
[accounts.example.com...]

GET / HTTP/1.1
Host: accounts.example.com
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:19.0) Gecko/20100101 Firefox/19.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: http://example.com/
Cookie: session=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Connection: keep-alive

HTTP/1.1 301 Moved Permanently
Date: Wed, 27 Feb 2013 23:34:07 GMT
Server: Apache
Location: [accounts.example.com...]
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Length: 195
Keep-Alive: timeout=5, max=88
Connection: Keep-Alive
Content-Type: text/html; charset=iso-8859-1
----------------------------------------------------------
[accounts.example.com...]

GET / HTTP/1.1
Host: accounts.example.com
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:19.0) Gecko/20100101 Firefox/19.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: http://example.com/
Cookie: session=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Connection: keep-alive

HTTP/1.1 301 Moved Permanently
Date: Wed, 27 Feb 2013 23:34:07 GMT
Server: Apache
Location: [accounts.example.com...]
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Length: 195
Keep-Alive: timeout=5, max=87
Connection: Keep-Alive
Content-Type: text/html; charset=iso-8859-1
----------------------------------------------------------
[accounts.example.com...]

GET / HTTP/1.1
Host: accounts.example.com
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:19.0) Gecko/20100101 Firefox/19.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: http://example.com/
Cookie: session=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Connection: keep-alive

HTTP/1.1 301 Moved Permanently
Date: Wed, 27 Feb 2013 23:34:07 GMT
Server: Apache
Location: [accounts.example.com...]
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Length: 195
Keep-Alive: timeout=5, max=86
Connection: Keep-Alive
Content-Type: text/html; charset=iso-8859-1
----------------------------------------------------------
[accounts.example.com...]

GET / HTTP/1.1
Host: accounts.example.com
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:19.0) Gecko/20100101 Firefox/19.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: http://example.com/
Cookie: session=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Connection: keep-alive

HTTP/1.1 301 Moved Permanently
Date: Wed, 27 Feb 2013 23:34:07 GMT
Server: Apache
Location: [accounts.example.com...]
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Length: 195
Keep-Alive: timeout=5, max=85
Connection: Keep-Alive
Content-Type: text/html; charset=iso-8859-1
----------------------------------------------------------
[accounts.example.com...]

GET / HTTP/1.1
Host: accounts.example.com
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:19.0) Gecko/20100101 Firefox/19.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: http://example.com/
Cookie: session=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Connection: keep-alive

HTTP/1.1 301 Moved Permanently
Date: Wed, 27 Feb 2013 23:34:07 GMT
Server: Apache
Location: [accounts.example.com...]
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Length: 195
Keep-Alive: timeout=5, max=84
Connection: Keep-Alive
Content-Type: text/html; charset=iso-8859-1
----------------------------------------------------------
[accounts.example.com...]

GET / HTTP/1.1
Host: accounts.example.com
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:19.0) Gecko/20100101 Firefox/19.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: http://example.com/
Cookie: session=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Connection: keep-alive

HTTP/1.1 301 Moved Permanently
Date: Wed, 27 Feb 2013 23:34:07 GMT
Server: Apache
Location: [accounts.example.com...]
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Length: 195
Keep-Alive: timeout=5, max=83
Connection: Keep-Alive
Content-Type: text/html; charset=iso-8859-1
----------------------------------------------------------
[accounts.example.com...]

GET / HTTP/1.1
Host: accounts.example.com
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:19.0) Gecko/20100101 Firefox/19.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: http://example.com/
Cookie: session=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Connection: keep-alive

HTTP/1.1 301 Moved Permanently
Date: Wed, 27 Feb 2013 23:34:07 GMT
Server: Apache
Location: [accounts.example.com...]
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Length: 195
Keep-Alive: timeout=5, max=82
Connection: Keep-Alive
Content-Type: text/html; charset=iso-8859-1
----------------------------------------------------------
[accounts.example.com...]

GET / HTTP/1.1
Host: accounts.example.com
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:19.0) Gecko/20100101 Firefox/19.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: http://example.com/
Cookie: session=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Connection: keep-alive

HTTP/1.1 301 Moved Permanently
Date: Wed, 27 Feb 2013 23:34:07 GMT
Server: Apache
Location: [accounts.example.com...]
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Length: 195
Keep-Alive: timeout=5, max=81
Connection: Keep-Alive
Content-Type: text/html; charset=iso-8859-1
----------------------------------------------------------

g1smd




msg:4549627
 12:09 am on Feb 28, 2013 (gmt 0)

The Redirect MUST test THE_REQUEST, not QUERY_STRING, to ensure the client asked for the parameters.

If you test QUERY_STRING, the redirect is invoked again after the internal rewrite and you WILL have a loop.

This 42 message thread spans 2 pages: < < 42 ( 1 [2]
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