All pastes #161549 Raw Edit

Miscellany

public text v1 · immutable
·published 2006-09-05 15:34 UTC
rendered paste body
.htaccess
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase    /~jhendric/mod_rewrite_test
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
</IfModule>

index.php
<?php echo'<pre>';print_r($_SERVER);echo'</pre>'; ?>

http://localhost/~jhendric/mod_rewrite_test/this+is/ok
Array
(
    [REDIRECT_STATUS] => 200
    [HTTP_HOST] => yankee
    [HTTP_USER_AGENT] => Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.6) Gecko/20060728 Firefox/1.5.0.6
    [HTTP_ACCEPT] => text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
    [HTTP_ACCEPT_LANGUAGE] => en-us,en;q=0.5
    [HTTP_ACCEPT_ENCODING] => gzip,deflate
    [HTTP_ACCEPT_CHARSET] => ISO-8859-1,utf-8;q=0.7,*;q=0.7
    [HTTP_KEEP_ALIVE] => 300
    [HTTP_CONNECTION] => keep-alive
    [HTTP_COOKIE] => CAKEPHP=2d44c587379c4a7beeb2a8af70c32fe7
    [HTTP_CACHE_CONTROL] => max-age=0
    [PATH] => /usr/local/bin:/usr/bin:/bin
    [SERVER_SIGNATURE] => 
Apache/2.0.55 (Debian) mod_jk2/2.0.4 PHP/5.1.4-0.1 mod_perl/2.0.2 Perl/v5.8.8 Server at yankee Port 80


    [SERVER_SOFTWARE] => Apache/2.0.55 (Debian) mod_jk2/2.0.4 PHP/5.1.4-0.1 mod_perl/2.0.2 Perl/v5.8.8
    [SERVER_NAME] => yankee
    [SERVER_ADDR] => 10.10.10.117
    [SERVER_PORT] => 80
    [REMOTE_ADDR] => 10.10.10.56
    [DOCUMENT_ROOT] => /var/www
    [SERVER_ADMIN] => webmaster@localhost
    [SCRIPT_FILENAME] => /home/jhendric/public_html/mod_rewrite_test/index.php
    [REMOTE_PORT] => 4118
    [REDIRECT_QUERY_STRING] => url=this+is/ok
    [REDIRECT_URL] => /~jhendric/mod_rewrite_test/this+is/ok
    [GATEWAY_INTERFACE] => CGI/1.1
    [SERVER_PROTOCOL] => HTTP/1.1
    [REQUEST_METHOD] => GET
    [QUERY_STRING] => url=this+is/ok
    [REQUEST_URI] => /~jhendric/mod_rewrite_test/this+is/ok
    [SCRIPT_NAME] => /~jhendric/mod_rewrite_test/index.php
    [PHP_SELF] => /~jhendric/mod_rewrite_test/index.php
    [REQUEST_TIME] => 1157470191
    [argv] => Array
        (
            [0] => url=this
            [1] => is/ok
        )

    [argc] => 2
)

http://yankee/~jhendric/mod_rewrite_test/this%26is/not%26ok
Array
(
    [REDIRECT_STATUS] => 200
    [HTTP_HOST] => yankee
    [HTTP_USER_AGENT] => Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.6) Gecko/20060728 Firefox/1.5.0.6
    [HTTP_ACCEPT] => text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
    [HTTP_ACCEPT_LANGUAGE] => en-us,en;q=0.5
    [HTTP_ACCEPT_ENCODING] => gzip,deflate
    [HTTP_ACCEPT_CHARSET] => ISO-8859-1,utf-8;q=0.7,*;q=0.7
    [HTTP_KEEP_ALIVE] => 300
    [HTTP_CONNECTION] => keep-alive
    [HTTP_COOKIE] => CAKEPHP=2d44c587379c4a7beeb2a8af70c32fe7
    [PATH] => /usr/local/bin:/usr/bin:/bin
    [SERVER_SIGNATURE] => 
Apache/2.0.55 (Debian) mod_jk2/2.0.4 PHP/5.1.4-0.1 mod_perl/2.0.2 Perl/v5.8.8 Server at yankee Port 80


    [SERVER_SOFTWARE] => Apache/2.0.55 (Debian) mod_jk2/2.0.4 PHP/5.1.4-0.1 mod_perl/2.0.2 Perl/v5.8.8
    [SERVER_NAME] => yankee
    [SERVER_ADDR] => 10.10.10.117
    [SERVER_PORT] => 80
    [REMOTE_ADDR] => 10.10.10.56
    [DOCUMENT_ROOT] => /var/www
    [SERVER_ADMIN] => webmaster@localhost
    [SCRIPT_FILENAME] => /home/jhendric/public_html/mod_rewrite_test/index.php
    [REMOTE_PORT] => 4122
    [REDIRECT_QUERY_STRING] => url=this&is/not&ok
    [REDIRECT_URL] => /~jhendric/mod_rewrite_test/this&is/not&ok
    [GATEWAY_INTERFACE] => CGI/1.1
    [SERVER_PROTOCOL] => HTTP/1.1
    [REQUEST_METHOD] => GET
    [QUERY_STRING] => url=this&is/not&ok
    [REQUEST_URI] => /~jhendric/mod_rewrite_test/this%26is/not%26ok
    [SCRIPT_NAME] => /~jhendric/mod_rewrite_test/index.php
    [PHP_SELF] => /~jhendric/mod_rewrite_test/index.php
    [REQUEST_TIME] => 1157470246
    [argv] => Array
        (
            [0] => url=this&is/not&ok
        )

    [argc] => 1
)