开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜