Jump to content

Internal sever error happening with mod-rewrite, why!


dsaba

Recommended Posts

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!

 

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.