PDA

View Full Version : .htaccess: How to show one html file?



Morgan Bohman
August 7, 2012, 06:01 AM
Hi guys,
I want to use my web site, not only for Classifieds, but also for some landing pages but then I have to configure .htaccess to let me show them. Is there an easy way to do that?

I have tried with RewriteRule ^filename\.html$ filename.html [NC,L] as I have a page named filename.html in folder filename so it should be able to locate it or do I have to insert folder as well like RewriteRule ^filename\.html$ filename/filename.html [NC,L]?

Can I call that file without loading the Flynax sw up or is that impossible? Is there a way that some folder on the site can work as "normal"? Or do I have the make a link to an external site like the pdf case John wrote about?

Vladimir
August 7, 2012, 06:42 AM
Hello,

You can fix the problem in the following way:

1. Create a new .htaccess file in your directory with html files.
2. Put following code in .htaccess file:



RewriteEngine on

RewriteBase /your_dir/

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f


Whereupon you can use the links as follows: http://domain.com/your_dir/test.html

Morgan Bohman
August 7, 2012, 07:16 AM
Thanks Vladimir, it worked like clockwork !

Manikandan Subramanian
November 3, 2013, 08:49 AM
I have a subfolder name called web
i added the a new .htaccess code file to the web folder, again getting the same 404 error, also not able
to open any folder or file under web subfolder.

thank you