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


Use REQUEST_URI when you want to compare a pattern to the URI. Use REQUEST_FILENAME when you want the filename.

Think I slightly get what you mean about URI and FILENAME. I’ll definitely need more time to explore the use of these 2 requests in order to understand more on how different they behave in the process of mod-rewrite. Thanks for that.

(if your routine/ files will always have a dash in the name, and there will never be other files with dashes in the name, then you might be able to write a rule to recognize that. But that’s a big “if,” and I would not recommend this approach.)

I take your advice. I don’t want to get complicated with this mod_rewrite thing too since I just started to learn it 10 days ago. By the way, I saw this:

RewriteRule ^([a-zA-Z_-\s]+)/$ /$1.html

What does that _-\s do?