开发者

how to rewrite this simple url?

开发者 https://www.devze.com 2022-12-09 02:43 出处:网络
how can i rewrite www.mysite.com/someURLhere into www.mysite.com/ping.php?url=someURLhere without mistaking local files, and directories as domains.

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

精彩评论

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