Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a database with a string column made up of four unique digits attached to each record. I know this isn't the best way to do this but I'm kind of stuck with it. I'm trying to rewrite urls from http://www.mydomain.com/0001 or http://www.mydomain.com/0053 and so on to go to http://www.mydomain.com/myfile.php?code=0001 or code=0053. I have this and its doing something weird:

RewriteEngine On
RewriteRule ^\d{4}?$ /myfile.php?code=$1 [NC,L]

it's taking me to myfile.php but the querystring isn't there. I'm not great with regex or htaccess and have been doing the best to piece together solutions from google. My apologies if this is a dumb question.

share|improve this question
    
How are you retrieving the query string? –  Shane Madden Oct 3 '13 at 21:10
    
php, I have this rewrite in another site and it works well RewriteEngine On RewriteRule ^event/([0-9]+)/?$ event.php?e=$1 [NC,L] –  Chris Flannagan Oct 3 '13 at 21:16
    
Right - what I'm getting at is maybe the method you're using to retrieve the query string is looking at the original request instead of the rewritten one? But, are you using the same method to retrieve as the working case? If so, then that's not the problem. –  Shane Madden Oct 3 '13 at 21:29

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.