$ inside the original file name

Oh, the strange things mod_rewrite does!

$ inside the original file name

Postby needhelp » Thu Mar 27, 2008 8:52 am

I need to redirect files containing $123.php to $.php, e.g. whatever$1.php file to whatever$.php file.

I tried
RewriteRule ^(.*)\$([0-9]*)(\..*)$ $1\$$3 [NC,L]
but it did not work.

How do I do this?

Thank you very much for your help!

needhelp
needhelp
 
Posts: 6
Joined: Thu Feb 14, 2008 1:53 pm

Postby richardk » Thu Mar 27, 2008 5:17 pm

Did you get a 500 error? If you did, it's because your rule matches the URL your are rewriting to. Try
Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteRule ^(.*\$)[0-9]+(\..+)$ /$1$2 [QSA,L]
Last edited by richardk on Fri Mar 28, 2008 12:29 pm, edited 2 times in total.
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby needhelp » Thu Mar 27, 2008 10:45 pm

Richard,

Your suggestion worked.

Thank you for all your help,
-needhelp no more
needhelp
 
Posts: 6
Joined: Thu Feb 14, 2008 1:53 pm


Return to Idiosyncrasies

Who is online

Users browsing this forum: No registered users and 16 guests

cron