Forum Moderators: phranque

Message Too Old, No Replies

mod_rewrite - many into one?

Rewrite simplification

         

Catweasel

7:54 am on Mar 21, 2004 (gmt 0)



These work:

RewriteEngine on
RewriteBase /
RewriteRule ^section1$ /section1/ [R]
RewriteRule ^section2$ /section2/ [R]
...
RewriteRule ^section20$ /section20/ [R]

I would like to know how not to have to specify each one like this. What would be even better would be if I could take ANY request which does not have a dot in it and make sure it has a trailing slash.

Trust me, I'm a doctor.
Catweasel

[edited by: jdMorgan at 12:58 pm (utc) on Mar. 21, 2004]
[edit reason] Removed URL sig per TOS [/edit]

dcrombie

12:22 pm on Mar 21, 2004 (gmt 0)



You should edit your post to remove the URLs - see the TOS for WebmasterWorld.

To answer your question:

RewriteRule ^section([0-9]+)$ /section$1/ [R]

;)

jdMorgan

1:08 pm on Mar 21, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Catweasel,

Welcome to WebmasterWorld [webmasterworld.com]!

Apache mod_dir (if loaded) should automatically fix trailing slash problems, so make sure you haven't by-passed it somehow.

If you do need a mod_rewrite solution, see msg #5 in the thread at [webmasterworld.com...]

Jim