.htaccess

software development

#1

OK, here is my code:

Options +FollowSymlinks
RewriteEngine on
RewriteRule ^(.*)$ index.php?user=$1 [nc]

when I run the page, it shows up, but when I try to echo out user, I get index.php… What is wrong?

echo $_GET[‘user’];


TzFiles.com


#2

You forgot to tell us what you want your code to do. However I can say that the code you psoted doesn’t make sense.RewriteRule ^(.*)$ index.php?user=$1 [nc]What you observce is what the code is supposed to do:

  1. Browse to http://example.com/index.php
  2. The RewriteRule operates on the test string “index.php” (the leading slash is stripped)
  3. The expression matches the entire test string and captures the entire string into $1
  4. The new URL becomes http://example.com/index.php?user=index.php

This doesn’t make sense because you appear to have forgotten to limit this rule to certain URLs. As it stands it operates on all URLs which is probably not what you intended.

:cool: openvein.org -//- One-time [color=#6600CC]$50.00 discount[/color] on [color=#0000CC]DreamHost[/color] plans: Use ATROPOS7