Jump to content

What am I doing wrong?


nethnet

Recommended Posts

I feel like this is a really simple problem...  I'm working with mod_rewrite and I've done so for years, and never had a problem.  But all of a sudden on this new server, I'm having a problem getting the $_GET array to contain.. well, anything.  Everytime a page is redirected, the $_GET array is empty.

 

RewriteEngine on
RewriteRule ^user/([a-zA-Z0-9]+)/?$ user.php?name=$1

 

The page is actually redirected to user.php without any problem, but when I try to pull out the $_GET['name'] data, it is empty, everytime.

 

Am I doing something incredibly stupid?  I'm hoping so...  I really don't want to have to configure Apache or anything...

 

Thanks in advance.

Link to comment
https://forums.phpfreaks.com/topic/198049-what-am-i-doing-wrong/
Share on other sites

@dreamwest,

 

Thanks for the response.  Unfortunately, the $_GET array is still coming up empty when /user/testuser is accessed.  So my fears are true... it's not an issue with REGEX errors or anything.  Something is going fishy with Apache itself.

 

Any other input is appreciated...  I have no idea where to begin with fixing this.

The rewrite looks ok, try removing the query and adding a second rewrite, if that doesnt work its nor your code

 

Options +FollowSymLinks
RewriteEngine on

RewriteRule ^user/(.*)/(.*) user.php?name=$1 [L,QSA]

 

and make sure url rewrite is on in your sever panel

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.