简体   繁体   中英

PHP redirect user through .htaccess and pass requested URL to php?

Say I'm trying to access:

mysite.com/foo/bar/

I want too:

RewriteEngine On
RewriteCond %{REQUEST_URI} !=/index.php
RewriteRule .* /index.php

Then:

$url = $_SERVER['PHP_SELF'];
echo $url;

To show:

foo/bar/

Currently getting:

index.php

(Obviously I have no idea, but you get the point for what I'm trying to achieve)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM