This is a discussion on Some problems with mod_rewrite module within the Apache Web Server forums, part of the Web Server and Related Forums category; I have read a documentation of mod_rewrite module, I have started a few tests and I have a few problems ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
I have read a documentation of mod_rewrite module, I have started a
few tests and I have a few problems Firstly, I couldn't set environment variable, that is to say if I set environment variable in mod_rewrite, I can't get it in PHP ..htaccess RewriteRule (.*) ind.php [E=A:ble] ind.php <? echo'<pre>'; print_r($_ENV); ?> I haven't the $_ENV['A'] Is this normal? or maybe I do sth wrong? Secondly, I can't use -x in my mod_rewrite, for example: RewriteCond path/to/the/file.ext -x As far as I know this condition should be executed when some file have chmod 777 or something, but I change this attribute and nothing happens Thirdly, I discovered something, I have some URL: http://www.example.com/sth17 and a rule in .htaccess RewriteRule ^([a-z\.]+) index.php?$1 in index.php I print $_GET and I get one key in this array without any value, this key is [index_php] when I change my rule to RewriteRule ^([a-z\.]+)([0-9]+) index.php?$1=$2 I get: [sth] => 17 but I have found nowhere information about behaviour like this 4. I want to rewrite url like this: http://www.subdomain.example.com/path/to/file.ext to http://www.example.com/subdomain/path/to/file.ext I try with .htaccess like this RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} !^www\.zawi\.dreamhosters\.com$ RewriteCond %{HTTP_HOST} ^(www\.)?([^.]+)\.zawi\.dreamhosters\.com$ RewriteRule .* %2%{REQUEST_URI} when I delete %{REQUEST_URI} everything is fine, and the url http://subdomain.example.com/ is rewrited to http://example.com/subdomain/, but when I leave it I get ERROR 500 Misconfiguration server or sth like that 5. I found somewhere code like that RewriteCond %{HTTP_HOST}<>%{REQUEST URI} condition_in_regexp but I can't find nowhere what does it mean <> thank you in advance |
| Thread Tools | |
| Display Modes | |
|
|