dsaba Posted June 2, 2008 Share Posted June 2, 2008 I'm quite sure that I'm messing up in the mod-rewrite syntax. Why? Well, I try something like this and I DONT get an internal server error and it works just fine: RewriteEngine On RewriteBase /q/ RewriteRule ^pic\.gif$ pic.php HOWEVER, when I try doing this: RewriteEngine On RewriteBase /q/ RewriteRule ^/l/(.+?)\.gif$ pic.php?q=$1 I DO get an internal server error! So If you can't see the expression i'm trying to do already, i'll explain it for you. I have a directory named 'q' which is 1 past the root, from afar it will look like this: root/q/ ->files are in here So I write RewriteBase /q/ I want to redirect all urls formed like this: http://root/q/l/jkasdlfj89u8923498234.gif to http://root/q/pic.php?u=jkasdlfj89u8923498234 You see the pattern here? So how can I write it and it will work without internal server error? You saw my attempt already. Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/108321-internal-sever-error-happening-with-mod-rewrite-why/ Share on other sites More sharing options...
BillyBoB Posted June 2, 2008 Share Posted June 2, 2008 Hey, um you have errors in your regex. You must escape slashes. So do: RewriteEngine On RewriteBase /q/ RewriteRule ^\/l\/(.+?)\.gif$ pic.php?q=$1 Well please feel free to contact me on aim anytime I didn't mean to scare you away. Quote Link to comment https://forums.phpfreaks.com/topic/108321-internal-sever-error-happening-with-mod-rewrite-why/#findComment-555380 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.