how to hide folder and file extension in rul

Avatar
  • updated
  • Answered

for example, display  "www.mysite.com/doit" in stead of  "www.mysite.com/myfiles/doit.php". i have tried to add following lines in the www.mysite.com/, also tried to add the .htaccess file in "myfiles" folder, but they don't work.


RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule /doit  /myfiles/doit.php/$1 [L]

thanks

Pinned replies
Avatar
JT S.
  • Answer
  • Answered
Hello and thanks for asking. Please see our related article to your question.
Avatar
John-Paul B
Quote from willyin2015

thank you for the reply, unfortunately, it won't work for me. after change the web root to my website www.10000miles.net, i tried many different changes to the .htaccess file, but when click the "Contact Us" menu on my web page, the full file path shows in the url. i did clear up catches.

Any idea?

This is difficult because this tactic may be seen as possibly tricky. Our guide on How to Redirect a Domain without Changing the URL may be a possible solution. If you are using a CMS such as WordPress, Drupal, or Joomla, you may be able to use a plugin or extension. Also, here is a possible solution I found via online search where they discuss possible options. 

Avatar
willyin2015

thank you for the reply, unfortunately, it won't work for me. after change the web root to my website www.10000miles.net, i tried many different changes to the .htaccess file, but when click the "Contact Us" menu on my web page, the full file path shows in the url. i did clear up catches.

Any idea?

Avatar
JT S.
  • Answer
  • Answered
Hello and thanks for asking. Please see our related article to your question.