Reputation: 13
I am trying to pass the entire Request_Uri into a $_GET request however the only things it's passing is 'test.php'
Htaccess code
RewriteEngine on
RewriteRule ^(.*)$ test.php?data=$1 [L]
test.php
<?php
echo $_GET['data'];
?>
However the only thing it display is 'test.php' what am I doing wrong?
Upvotes: 1
Views: 36
Reputation: 786359
Use this:
RewriteEngine on
# skips files
RewriteCond %{REQUEST_FILENAME} !-f
# skips directories
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ test.php?data=$1 [L,QSA]
Without these 2 conditions your rules runs twice since you're matching .*
and you get rewritten URI test.php
as GET
parameter.
Upvotes: 1