2

Is it better to make clean URL's using index files in directories or simply using mod_rewrite rules to remove the file extensions?

  • 1
    Whatever helps to keep you organized. If you have lots of pages you're gonna hate having lots of directories. – John Conde Aug 9 '13 at 18:31
  • How would you propose to implement the "index files in directories" in order to make clean URLs? – MrWhite Aug 9 '13 at 19:34
  • Just read up on mod_rewrite to come up with the solution that best fits you. net.tutsplus.com/tutorials/other/… – Linus Juhlin Feb 4 '14 at 16:39
1

There is no need to remove file extensions in order to create "clean URL's" as a URL with a file extension is no messier than one without a file extension. If you absolutely need to remove the file extensions then it is easier to use mod_rewrite as you won't need to create such a complex directory structure to achieve what files can achieve instead. As a side note if you use mod_rewrite and use a basic rule to remove the file extension you will need to make sure that all the files in question have the same file extension (ie: all files are .html files) otherwise you will need to create a separate rule for each file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.