Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Other How to remove subdirectories using mod_rewrite in .htaccess Reply To: How to remove subdirectories using mod_rewrite in .htaccess

#170833
ewisely
Participant

Hi traq,

RewriteRule ^([A-Za-z]+)/$ /cat/play/$1.html [L]

Yup, I tried your example and that works for a single file. Like you said,

mod_rewrite cannot “guess” what you want it to do

So, I guess I just have to create every rule for each file if I were to place them in different subdirectories. I will also try out your example and see how well it works for my case:

RewriteRule ^play/([A-Za-z]+)/$ /cat/play/$1.html [L]
RewriteRule ^rest/([A-Za-z]+)/$ /cat/rest/$1.html [L]

Thank you very much for your tips and effort in replying. Appreciate that a lot. :D