my colleague has a website which currently rewrites page_XX to ?page=XX. he'd like it to cope with extra GETs e.g. page_XX?q=1&w=2 to ?page=XX&q=1&w=2 but we've struggled with getting the extra GETs to even register with the PHP. suggestions highly appreciated.
I don't know if it's any help, but I've got a .htaccess which rewrites blog.slickhouse.com to slickhouse.com - and it deals with any subpages/arguments. So, if you went to blog.slickhouse.com/something, it'll rewrite it to slickhouse.com/something - the same with PHP pages. Code: RewriteEngine on RewriteCond %{HTTP_HOST} ^blog.slickhouse.com$ [OR] RewriteCond %{HTTP_HOST} ^www.blog.slickhouse.com$ RewriteRule ^(.*)$ http://slickhouse.com/$1 [R=301,L]
unfortunately the extra variables are variable, so he can't rely on anything which specifies them. would .*? make sense? wouldn't that mean: any char;zero or more times;zero or one times...
If page_xx?q=1&w=2 is being parsed by PHP, you can (maybe) do this: PHP: $parsed = parse_url($_SERVER['REQUEST_URI']);$page = "page=" . substr($parsed['path'], -2);$get = ($parsed['query'] != null) ? "&" . $parsed['query'] : "";header("Location: ?{$page}{$get}");
heh, I had always assumed that $_SERVER['REQUEST_URI'] would be rewritten too, but it's not. so thank you!