Jump to content

Regex in htaccess


Daleeburg

Recommended Posts

ok i realize this is not php, but i am using it on a php site and a regex is a regex right?

 

I am looking into creating a file protection the only problem is that i can not get this working again. 

 

the address looks like this

 

www.domain.com/file_man/files/2/items.txt

 

This does not work

 

RewriteEngine On
Options +FollowSymLinks

# Rewrite /file_man/files/xxxx/yyyy.zzz to test.php?file=yyyy&type=zzz&user=xxxx
RewriteRule ^file_man/files/([^/]+)/([^\.]+)\.([^/]+)$ /file_man/test.php?file=$2&type=$3&user=$1 [NC,L]

 

This does work

 

RewriteEngine On
Options +FollowSymLinks

# Rewrite /file_man/files/yyyy.zzz to test.php?file=yyyy&type=zzz&
RewriteRule ^file_man/files/([^\.]+)\.([^/]+)$ /file_man/test.php?file=$1&type=$2 [NC,L]

 

the only difference it he third variable which should be a number, any thoughts?

 

~d

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.