Home Htaccess redirect not displaying values
Reply: 1

Htaccess redirect not displaying values

asn559
1#
asn559 Published in 2018-01-12 14:15:52Z

so I'm trying to make a pretty URL using htaccess

I want to convert www.domain.com/r.php?id=123 to www.domain.com/r/123

I used this htaccess code to do it :-

Options +FollowSymLinks
RewriteEngine On

RewriteRule ^r/([0-9]*)/([a-z]*)$ ./r.php?user=$1

However, on r.php, when I try to get the value of ID..I get

/Library/WebServer/Documents/ico/main/r.php:2:
array (size=0)
  empty

Here;s my r.php file

<?php
var_dump($_REQUEST);
?>

What am I doing wrong in here?

pc_
2#
pc_ Reply to 2018-01-12 14:46:21Z

If your link contains id then make sure in your .htaccess rewrite rule you are actually using id. So just follow this logic:

RewriteEngine On 
RewriteRule whatever/r/(.*)script_name.php?id=$1 [L]
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.295914 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO