D&C GLug - Home Page

[ Date Index ] [ Thread Index ] [ <= Previous by date / thread ] [ Next by date / thread => ]

[LUG] apache mod_rewrite

 

G'day all,

I have a url that comes in as
url1 = /dir1/dir2/dir3/string_part_1/string_part_2/page.html
or
url2 = /dir1/dir2/dir3/string/page.html

And I want to remove dir1 dir2 dir3 and page.html

dir1 is static
dir2 and dir3 change

url1 works
url2 does not

Here is my RewriteRule
RewriteRule ^/dir1/.*/.*/(.*)/page.html /$1 [R=301]

Redirect is working but I get
string_part_2
and I want
string_part_1/string_part_2

It has to do with the / in between string_part_1 and Part_2

None of the dir's are actually dir's.

I am stumped... (it is bound to be something really simple)

-- 
'ooroo

Stinga...(:)-)
---------------------------------------------------
Email: stinga+mythtv@xxxxxxxxxxxxx  o
You need only two tools.        o /////
A hammer and duct tape. If it    /@   `\  /) ~
doesn't move and it should use  >  (O)  X<  ~  Fish!!
the hammer. If it moves and      `\___/'  \) ~
shouldn't, use the tape.           \\\
---------------------------------------------------


-- 
'ooroo

Stinga...(:)-)
---------------------------------------------------
Email: stinga+dclug@xxxxxxxxxxxxx   o
You need only two tools.        o /////
A hammer and duct tape. If it    /@   `\  /) ~
doesn't move and it should use  >  (O)  X<  ~  Fish!!
the hammer. If it moves and      `\___/'  \) ~
shouldn't, use the tape.           \\\
---------------------------------------------------
-- 
The Mailing List for the Devon & Cornwall LUG
http://mailman.dclug.org.uk/listinfo/list
FAQ: http://www.dcglug.org.uk/listfaq