Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

stumped on a rewriterule

Status
Not open for further replies.

mattalexx

Programmer
May 23, 2002
6
US
I'm trying to accept this:
Code:
/checkdomain?mydomain
and rewrite it as this:
Code:
/checkdomain.php?domain=mydomain
This is what I have so far:
Code:
RewriteRule ^hosting/checkdomain?(.*) pages/hosting/checkdomain.php?domain=$1 [L]
and I'm getting this as a $_GET:
Code:
Array
(
    [domain] => 
)
I have a feeling that that question mark in the nice URL is causing problems.
 
I'm rusty on the details of the Rewrite regex engine, but if it were following perl regex then you'd *probably* need to escape the "?" in your condition with "\?"

Someone smarter than I may see something else, but it's worth a try until an expert drives by...

Also, make sure the mod_rewrite module is loaded, etc....

D.E.R. Management - IT Project Management Consulting
 
Hi

The pattern is matched against the [tt]REQUEST_URI[/tt], so there is no [tt]QUERY_STRING[/tt] part there to be captured.
Code:
RewriteRule ^hosting/checkdomain$ pages/hosting/checkdomain.php?domain=%{QUERY_STRING} [L]

Feherke.
 
PLEASE IGNORE THE LAST POST. THIS IS THE CORRECT ONE.

I'm trying to accept this:
Code:
/hosting/checkdomain?mydomain
and rewrite it as this:

Code:
/pages/hosting/checkdomain.php?domain=mydomain
This is what I have so far:
Code:
RewriteEngine On
RewriteRule ^hosting/checkdomain?(.*) pages/hosting/checkdomain.php?domain=$1 [L]
and I'm getting this as a $_GET:
Code:
// In the address bar: http://[server]/hosting/checkdomain?mydomain
Array
(
    [domain] => 
)
I have a feeling that that question mark in the nice URL is causing problems.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top