35

I'm having small troubles and was wondering if someone can help me over the hump. I pulled a copy of a website down from Hostgator and I'm trying to set it up on my local machine using WAMP but, I keep getting an error when trying to access the site. Here is what I have tried..I went to Apaches httpd.conf file and uncommented the # from LoadModule rewrite_module modules/mod_rewrite.so. Also I have changed the AllowOverride None to All. With that said, Im not sure what else to look for. Please note within my application my httaccess files do not have a (.) in front of them (.htaccess). I'm not sure if that is worth noting or not. Any ideas as to what I need to do to access my site? When I access the application I do see a cached version (white screen), but when I click the link to log in I see the 404 Not Found.

Daryl Bennett
  • 462
  • 10
  • 22
SkillSet
  • 621
  • 2
  • 7
  • 15
  • 1
    What URL are you trying to access and what file do you want it to pull up? The dot in `.htaccess` is required http://smartwebdeveloper.com/apache/htaccess-problems – Sarah Kemp Sep 17 '13 at 14:53
  • I am trying to access my login page Slic/users/login. I want it to pull up the login view. – SkillSet Sep 17 '13 at 15:01
  • Ok I got it. I had to go and rename all the .htaccess files. The 1st one being in www\Slic\.htaccess. The next one was in www\Slic\app\.htaccess. The last was in www\Slic\app\webroot\.htaccess – SkillSet Sep 17 '13 at 15:11
  • Thanks for that article you posted!! It got me over the hump!! – SkillSet Sep 17 '13 at 15:11
  • Possible duplicate of [The requested URL /about was not found on this server](https://stackoverflow.com/questions/13149418/the-requested-url-about-was-not-found-on-this-server) – Damjan Pavlica Jul 26 '18 at 19:07

12 Answers12

43

In Ubuntu I did not found httpd.conf, It may not exit longer now. Edit in apache2.conf file working for me.

cd /etc/apache2
sudo gedit apache2.conf

Here in apache2.conf change

<Directory /var/www/>
     Options Indexes FollowSymLinks
     AllowOverride None
     Require all granted
</Directory>

to

<Directory /var/www/>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
</Directory>  
Bachcha Singh
  • 3,850
  • 3
  • 24
  • 38
28

In httpd.conf file you need to remove #

#LoadModule rewrite_module modules/mod_rewrite.so

after removing # line will look like this:

LoadModule rewrite_module modules/mod_rewrite.so

I am sure your issue will be solved...

Nunser
  • 4,512
  • 8
  • 25
  • 37
Urdesh Kumar
  • 1,120
  • 1
  • 17
  • 23
14

change this

Include conf/extra/httpd-vhosts.conf

to

#Include conf/extra/httpd-vhosts.conf

and restart all services

khan
  • 149
  • 1
  • 3
13

i was spend lots of time in this after then i found ...solution

first -
sudo a2enmod rewrite


sudo systemctl restart apache2

this line depends on your apache2 version you found on your console copy and past ...

      sudo nano /etc/apache2/sites-available/000-default.conf


     DocumentRoot "/var/www/html"
    <Directory "/var/www/html">
            Options FollowSymLinks
            AllowOverride All
            Require all granted
    </Directory>
Sandeep Kumar
  • 409
  • 4
  • 5
9

In apache version: 2.4.41

First, enable the apache rewrite module:

sudo a2enmod rewrite

you need to change in apache2.conf no need to change in sites-available

sudo gedit /etc/apache2/apache2.conf

Original

<Directory /var/www/>
     Options Indexes FollowSymLinks
     AllowOverride None
     Require all granted
</Directory>

To

<Directory /var/www/>
    Options Indexes FollowSymLinks
    AllowOverride all
    Require all granted
</Directory>

And restart apache2

sudo service apache2 restart
Jignesh Joisar
  • 13,720
  • 5
  • 57
  • 57
6

In wamp/alias/mySite.conf, be careful to add a slash "/" at the end of the alias' adress :

Replace :

Alias /mySite/ "D:/Work/Web/mySite/www"

By :

Alias /mySite/ "D:/Work/Web/mySite/www/"

Or the index.php is not read correctly.

Romain
  • 61
  • 1
  • 1
6

If your .htaccess file is ok and the problem persist try to make the AllowOverride directive enabled in your httpd.conf. If the AllowOverride directive is set to None in your Apache httpd.config file, then .htaccess files are completely ignored. Example of enabled AllowOverride directive in httpd.config:

 <Directory />
    Options FollowSymLinks
    **AllowOverride All**
 </Directory>

Therefor restart your server.

Badr Bellaj
  • 11,560
  • 2
  • 43
  • 44
1

For saving a file as .htaccess, when using windows, you have to open notepad and then saveas .htaccess as windows does not create files starting with a dot. That should get your .htaccess working and it'll clear up the issue.

By the way, in order to receive specific error messages set Configure::write('debug', 0); to '2' in app/config/core.php for development purposes.

Anugrah
  • 152
  • 1
  • 9
  • What I did to rename my .htaccess was open my command prompt and execute the following. Rename c:\wamp\www\app\htaccess.txt .htaccess – SkillSet Sep 17 '13 at 16:33
1

Just solved this problem! I know the question is quite old, but I just had this same problem and none of the answers above helped to solve it.

Assuming the actual domain name you want to use is specified in your c:\windows\System32\drivers\etc\hosts and your configurations in apache\conf\httpd.conf and apache\conf\extra\httpd-vhots.conf are right, your problem might be the same as mine:

In Apache's htdocs directory I had a shortcut linking to the actual project I wanted to see in the browser. It turns out, Apache doesn't understand shortcuts. My solution was to create a proper symlink:

In windows, and within the httdocs directory, I ran this command in the terminal:

mklink /d ple <your project directory with index.html> 

This created a proper symlink in the httpdocs directory. After restarting the Apache service and then reloading the page, I was able to see my website up :)

Jennifer
  • 11
  • 1
  • 2
1

For me, using OS X Catalina: Changing from AllowOverride None to AllowOverride All is the one that works.

httpd.conf is located on /etc/apache2/httpd.conf.

Env: PHP7. MySQL8.

Fadils
  • 1,508
  • 16
  • 21
1

https://create-react-app.dev/docs/deployment/

If you’re using Apache HTTP Server, you need to create a .htaccess file in the public folder that looks like this:

Options -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.html [QSA,L]

It will get copied to the build folder when you run npm run build.

Sanket Patil
  • 807
  • 1
  • 11
  • 19
0

In my case (running the server locally on windows) I needed to clean the cache after changing the httpd.conf file.

\modules\apache\bin> ./htcacheclean.exe -t
Leo
  • 1
  • 1