how to rewrite this simple url?
how can i rewrite
www.mysite.com/someURLhere
into
www.mysite.com/ping.php?url=someURLhere
without mistaking local files, and directories as domains.
so i开发者_开发知识库 dont want
www.mysite.com/index.php
www.mysite.com/admin/
to rewrite to
www.mysite.com/ping.php?url=index.php
www.mysite.com/ping.php?url=admin/
<VirtualHost *:80>
ServerName yoursite.com
DocumentRoot /www/yoursite
RewriteEngine On
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /ping.php?url=$1 [L,QSA]
</VirtualHost>
If this is a .htaccess file you dont need %{DOCUMENT_ROOT}
in both instances.
精彩评论