/web/home/index.html -> _web_home_index.html

Oh, the strange things mod_rewrite does!

/web/home/index.html -> _web_home_index.html

Postby forearrow » Mon Jul 23, 2007 7:21 pm

is it possible to replace all "/" to "_" ?

before go here to create a new thread, I searched the forum and found this:
viewtopic.php?t=3712&highlight=replace

but in my project, I can't use any dynimic tech
forearrow
 
Posts: 11
Joined: Fri Apr 27, 2007 10:37 pm

Postby richardk » Tue Jul 24, 2007 2:25 pm

Try
Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteRule ^_?(.+)/(.*)$ /_$1_$2 [QSA]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby forearrow » Tue Jul 24, 2007 6:38 pm

but if the number of "/" is uncertain,how to replace all "/" to "_" ?
forearrow
 
Posts: 11
Joined: Fri Apr 27, 2007 10:37 pm

Postby richardk » Wed Jul 25, 2007 10:07 am

It does/should do that, try it.
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am


Return to Idiosyncrasies

Who is online

Users browsing this forum: No registered users and 4 guests

cron