Tell me more ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I have this .htaccess in a po_systems folder of my website

# Set up mod_rewrite
RewriteEngine on
RewriteRule ^build_system/([^/]+)/([^/]+)/?$ /po_systems/build_system.php?business_id=$1&system_id=$2

and when i visit the url

http://somesite.localhost/po_systems/build_system/61/65F92751

the get variables are not displaying....i changed the rule to

RewriteRule ^build_dfdsadsafas/([^/]+)/([^/]+)/?$ /po_systems/build_system.php?business_id=$1&system_id=$2

to verify it was getting there and i still dont get the get variables so i tries to add junk at the begining to verify the htaccess is working

sssRewriteRule ^build_system/([^/]+)/([^/]+)/?$ /po_systems/build_system.php?business_id=$1&system_id=$2

and I got this

Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.

So basically my question is why is this rule

RewriteRule ^build_system/([^/]+)/([^/]+)/?$ /po_systems/build_system.php?business_id=$1&system_id=$2

not working for catching this url

 http://somesite.localhost/po_systems/build_system/61/65F92751d
share|improve this question
Try renaming your php file to something different than the 'virtual folder' you are creating. Loops like Apache's MultiViews it matching the url to the php file, bypassing the rewriterules. – Gerben Nov 7 '11 at 16:04
@Gerben - what do you mean the virtual folder i am creating ...the po_systems folder is a real folder...am i missing something – Tamer Nov 7 '11 at 17:29
I mean 'build_system' in your url '/po_systems/build_system/61/65F92751d'. Apache's multiview will see the build_system.php, and will assume you meant this file. So it will load this url /po_systems/build_system.php/61/65F92751d bypassing your rewrite rules. just rename the php file to e.g. build_system2.php – Gerben Nov 7 '11 at 18:11

migrated from stackoverflow.com Nov 8 '11 at 3:53

1 Answer

Just a guess, but try taking out the starting ^ in "^build_system/...". ^ means start of string, and it's probably coming in as "/build_system", so ^build_system would not match because it starts with a slash.

So:

RewriteRule build_dfdsadsafas/([^/]+)/([^/]+)/?$ /po_systems/build_system.php?business_id=$1&system_id=$2

Or maybe even just add the slash in there:

RewriteRule ^/build_dfdsadsafas/([^/]+)/([^/]+)/?$ /po_systems/build_system.php?business_id=$1&system_id=$2
share|improve this answer
In mod_rewrite urls don't start with a '/'. Some very old versions did though. – Gerben Nov 7 '11 at 18:08

Your Answer

 
discard

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