Forum Moderators: phranque
My .htaccess file is as follows:
Options +FollowSymLinks
RewriteEngine on
RewriteBase /
Rewritecond %{query_string} ^id=/(.*)$
RewriteRule ^getloc.php$ /getloc/%1? [L]
My static URL is:
[localhost...]
The underlying dynamic URL is:
[localhost...]
I'm sure there's something simple wrong with it, I have a script in my php page to access and output the 'id' url parameter but it doesn't work when using the static URL, but it does when using the dynamic form.
Does anyone have any ideas? I'm afraid my brain is in information overload due to all of the different threads I've read about this and I just can't see what's wrong.
Thanks a lot for any tips!
Rick
I'm using PHP to grab the url parameters, two different methods are used and they both work when I just use the standard URL like:
[localhost...]
but not when it is the static URL like:
[localhost...]
My PHP script is:
<?php $locvar = $_GET['id']; echo "Location is $locvar";?><br />
<?php echo $_SERVER['REQUEST_URI'];?><br />
<?php echo $HTTP_GET_VARS["id"];?>
Am I missing something or am I understanding correctly that with the Rewritecond statement in my .htaccess file that I should now be able to access these parameters using the static URL?
After reading my initial post I just wanted to confirm my intention, which is to have static urls (2004/getloc/10) map to (2004/getloc.php?id=10) therefore having search engine friendly URLs.
Once again I really appreciate any help offered :)
Rick
RewriteEngine on
RewriteBase /
RewriteRule ^info/(.*).html$ /info.php?phrase=$1 [L]
This should, as i understand it, rewrite
www.mydomain.com/info/foo.html
to
www.mydomain.com/info.php?phrase=foo
Therefore, passing foo to info.php as variable phrase
This should then be available for php to use.
The problem I am having is that on my testing server, this works fine, no problems at all. But when i upload the code to my clients server, it doesnt.
Any ideas what could be causing this?
Could it be something to do with Global Variables being on/off?
Is there a workround that doesnt involve parsing?
Any advise would be appreciated.
Any ideas what could be causing this?
You haven't been very specific about where the problem is, so it's hard to tell. It could be that the server you upload to is not an Apache server, or doesn't have mod_rewrite, or it could be a problem with PHP. So you'd have to check your log files for any problems with the server, then check how PHP is set up on the server if PHP is the problem. Or it could be something else?