Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

RewriteCond and php variables

3 views
Skip to first unread message

Peter

unread,
Nov 4, 2009, 1:02:58 PM11/4/09
to
Hey,

I'm struggling to make following work entirely the way I want it:

In .htaccess:

RewriteCond %{HTTP_HOST} ^(.*)?mydomain.jp [NC]
RewriteCond %{REQUEST_URI} !^/help\.php$ [NC]
RewriteCond %{REQUEST_URI} !^/tips\.php$ [NC]
RewriteRule (.*) http://www.mydomaincom/$1 [R=301,L]


Which translates to:
- every page on the .jp domain is routed to the .com domain
- EXCEPT when the files are:
- help.php (including all variables, e.g. help.php?page=10)
- tips.php (same as help.php)

Now for the latter one I would like to have it even more specific, namely
ONLY for when a certain variable is passed.
I would like it to work ONLY for:
tips.php?tips_page=5
and thus not for tips.php, or tips.php?tips_page=10 (or any other number)


Is that doable somehow ?

"Álvaro G. Vicario"

unread,
Nov 5, 2009, 3:37:24 AM11/5/09
to
Peter escribi�:

You should do something on the line of:

RewriteCond %{QUERY_STRING} ^tips_page=5$

If I'm not wrong, you can't really extract variables; the query string
must be handled as a string.

http://wiki.apache.org/httpd/RewriteQueryString
http://httpd.apache.org/docs/2.2/en/mod/mod_rewrite.html#rewriterule


--
-- http://alvaro.es - �lvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programaci�n web: http://borrame.com
-- Mi web de humor satinado: http://www.demogracia.com
--

Peter

unread,
Nov 5, 2009, 2:43:32 PM11/5/09
to
Thanks !

--

Best Regards,
Peter


""�lvaro G. Vicario"" <alvaro.NO...@demogracia.com.invalid> wrote in
message news:hcu2s8$tem$1...@news.eternal-september.org...

0 new messages