tags:

views:

48

answers:

1

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/
A: 
<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.

meder
`REQUEST_FILENAME` is already an absolute filesystem path.
Gumbo
I could've swore I ran into an issue somewhere, where it was necessary to prepend the DOCUMENT_ROOT part..
meder
Request exceeded the limit of 10 internal redirects due to probable configuration error.
lativo