http - How can I use .htaccess to load index.html for any URL without redirecting? -


i use .htaccess take urls this:

mydomain.com/hello-world

and have webserver load index.html - keep hello-world url intact. wouldn't redirect, assume.

ideally, not give 404 error either.

is possible? thanks!!

update: think i'm looking works url, or without trailing slash. so...

  • mydomain.com
  • mydomain.com/hello-world
  • mydomain.com/anything-else/

would load index.html, without changing url or giving 404 error. thank you

as per apache documentation, need add directoryindex directive .htaccess file.

this directive points 1 or more files, allows have redundancy in index files. here example:

directoryindex index.php index.html index.htm 

to keep simple, though, need .htaccess file in directory called "hello-world", users type http://example.com/hello-world/ (note trailing slash) additional rules (using mod_rewrite module), may redirect urls add trailing slash lack one.


Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -