Where is the .htaccess file located?
Posted by: ToddASchroeder (---.mntimn.dedicated.static.tds.net)
Date: July 27, 2014 11:28PM

Operating System - Windows 8.1
Wamp Server - 2.5
Apache - 2.4.9
MySQL - 5.6.17
PHP - 5.5.12

Wamp Manager Icon Color - Green

I am using Notepad ++ to create my website. I have over 50 pages with hundreds of links. I placed a working php script into my website and cannot view it by using Notepad ++. However, if I save my index.html page as index.php and use Apache Localhost I can now see the php script working. This now causes another problem as the link to my CSS Style Sheet is broken.

I've searched many websites and forums to find that if I were to place the following text into my .htaccess file it would solve this problem.

AddType application/x-httpd-php .html

The only problem is that I cannot find the .htaccess file. Note: I am using Apache 2.5 server on my own computer and have not yet used FTP to host my website with a Hosting Company.

Can anyone help me?

Options: ReplyQuote
Re: Where is the .htaccess file located?
Posted by: RiggsFolly (---.dynamic.dsl.as9105.com)
Date: July 28, 2014 12:10AM

There is no .htaccess file that comes with WAMPServer.

If you want to use one create it!

If you had one in the original copied system copy that

---------------------------------------------------------------------------------------------
(Windows 10 Pro 64bit) (Wampserver 3.3.4 64bit) Aestan Tray Menu 3.2.5.4
<Apache versions MULTIPE> <PHP versions MULTIPLE> <MySQL Versions MULTIPLE>
<MariaDB versions MULTIPLE> <phpMyAdmin versions MULTIPLE> <MySQL Workbench 8.0.23>

Read The Manuals Apache -- MySQL -- PHP -- phpMyAdmin
Get your Apache/MySQL/mariaDB/PHP ADDONs here from the WAMPServer alternate Repo
-X-X-X- Backup your databases regularly Here is How dont regret it later! Yes even when developing -X-X-X-



Edited 1 time(s). Last edit at 07/29/2014 12:22AM by RiggsFolly.

Options: ReplyQuote
Re: Where is the .htaccess file located?
Posted by: ToddASchroeder (---.mntimn.dedicated.static.tds.net)
Date: July 28, 2014 03:27AM

How do I create a .htaccess file?

Where do I place it once it is created?

Options: ReplyQuote
Re: Where is the .htaccess file located?
Posted by: RiggsFolly (---.dynamic.dsl.as9105.com)
Date: July 28, 2014 11:35AM

Create it with a half decent editor (not notepad) try notepad++ if you dont already have a decent editor (its free and an excelent editor for the price)

If you dont know where to place it, are you sure you actually need one?

What do you think you want to put in it?

What makes you think you need/want one?

---------------------------------------------------------------------------------------------
(Windows 10 Pro 64bit) (Wampserver 3.3.4 64bit) Aestan Tray Menu 3.2.5.4
<Apache versions MULTIPE> <PHP versions MULTIPLE> <MySQL Versions MULTIPLE>
<MariaDB versions MULTIPLE> <phpMyAdmin versions MULTIPLE> <MySQL Workbench 8.0.23>

Read The Manuals Apache -- MySQL -- PHP -- phpMyAdmin
Get your Apache/MySQL/mariaDB/PHP ADDONs here from the WAMPServer alternate Repo
-X-X-X- Backup your databases regularly Here is How dont regret it later! Yes even when developing -X-X-X-

Options: ReplyQuote
Re: Where is the .htaccess file located?
Posted by: ToddASchroeder (156.99.18.---)
Date: July 28, 2014 09:29PM

According to this website the problem is explained with a solution.

[php.about.com]

I have tried the solution saving the .htaccess file as a .txt File and All Types. I have placed it at the wamp/www directory and it does not work. Which is why I am hoping someone on this forum can help me.

Here is the article:

How can I execute PHP code on my existing myfile.html page? When a web page is accessed, the server checks the extension to know how to handle the page. Generally speaking if it sees a .htm or .html file, it sends it right to the browser because it doesn't have anything to process on the server. If it sees a .php extension (or .shtml, or .asp, etc), it knows that it needs to execute the appropriate code before passing it along to the browser.

Here is the problem: You find the perfect script, and you want to run it on your site, but you need to included PHP on your page for it to work. You could just rename your pages to yourpage.php instead of yourpage.html, but you already have incoming links or search engine ranking so you don't want to change the file name. What can you do?

First let me preface this by saying that if you are creating a new file anyway, you may as well use .php. This is to help people who have existing .html pages they need to execute PHP on.

The way to execute PHP on a .html page is to modify your .htaccess file. This file may be hidden, so depending upon your FTP program you may have to modify some settings to see it. Then you just need to add this line for .html: AddType application/x-httpd-php .html

Options: ReplyQuote
Re: Where is the .htaccess file located?
Posted by: RiggsFolly (---.dynamic.dsl.as9105.com)
Date: July 29, 2014 12:26AM

The filename should be .htaccess and not .htaccess.txt.

So rename the file using Explorer

or from a command window do 'REN .htaccess.txt .htaccess'

or Notepad++ do a 'Save As' .htaccess

---------------------------------------------------------------------------------------------
(Windows 10 Pro 64bit) (Wampserver 3.3.4 64bit) Aestan Tray Menu 3.2.5.4
<Apache versions MULTIPE> <PHP versions MULTIPLE> <MySQL Versions MULTIPLE>
<MariaDB versions MULTIPLE> <phpMyAdmin versions MULTIPLE> <MySQL Workbench 8.0.23>

Read The Manuals Apache -- MySQL -- PHP -- phpMyAdmin
Get your Apache/MySQL/mariaDB/PHP ADDONs here from the WAMPServer alternate Repo
-X-X-X- Backup your databases regularly Here is How dont regret it later! Yes even when developing -X-X-X-

Options: ReplyQuote
Re: Where is the .htaccess file located?
Posted by: ToddASchroeder (156.99.18.---)
Date: July 31, 2014 10:18PM

I created a .htaccess file and saved it at the wamp/www directory.

Since I have used Notepad ++ to create my HTML pages I used this first to see my PHP Code. It did not work so I tested my index.html page using Localhost and it finally worked.

I can also view my jQuery scripts by placing them at the wamp/www directory.

Thank you for your help.

Options: ReplyQuote


Sorry, only registered users may post in this forum.