404 Not Found The requested URL was not found on this server
Asked Answered
L

13

36

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.

Lurk answered 17/9, 2013 at 14:49 Comment(5)
What URL are you trying to access and what file do you want it to pull up? The dot in .htaccess is required smartwebdeveloper.com/apache/htaccess-problemsMatrilineage
I am trying to access my login page Slic/users/login. I want it to pull up the login view.Lurk
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\.htaccessLurk
Thanks for that article you posted!! It got me over the hump!!Lurk
Possible duplicate of The requested URL /about was not found on this serverHost
N
29

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...

Niven answered 17/12, 2013 at 14:38 Comment(6)
On Ubuntu the main Apache configuration file is actually apache2.conf . At directory: /etc/apache2/Libava
@DoNhuVy in ubuntu, add LoadModule rewrite_module modules/mod_rewrite.so to apache.conf?Transmittance
@QiankunSU , I think in this case: apache2.conf. Sorry, current I don't use Ubuntu.Libava
My MAMP have that uncomment already, and I still see that error The requested URL /login was not found on this server.Arteriovenous
I am new to server part. I cannot find httpd.conf file on ubuntu. Where to add that line?Catabolite
In the newer versions of apache2 it's a2enmode rewriteMythical
T
46

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>  
Telling answered 29/10, 2018 at 9:56 Comment(4)
This worked for me, but after making the change, don't forget execute: sudo a2enmod rewrite. And: sudo systemctl restart apache2.Forgather
This worked for me. Thanks!Ventage
This worked for me, thanks! Doing the sudo a2enmod rewrite. And: sudo systemctl restart apache2 after it, obviouslyDuodecimo
Thanks this worked for me also. After this run below commands \n sudo a2enmod rewrite And sudo systemctl restart apache2Malleable
N
29

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...

Niven answered 17/12, 2013 at 14:38 Comment(6)
On Ubuntu the main Apache configuration file is actually apache2.conf . At directory: /etc/apache2/Libava
@DoNhuVy in ubuntu, add LoadModule rewrite_module modules/mod_rewrite.so to apache.conf?Transmittance
@QiankunSU , I think in this case: apache2.conf. Sorry, current I don't use Ubuntu.Libava
My MAMP have that uncomment already, and I still see that error The requested URL /login was not found on this server.Arteriovenous
I am new to server part. I cannot find httpd.conf file on ubuntu. Where to add that line?Catabolite
In the newer versions of apache2 it's a2enmode rewriteMythical
J
14

change this

Include conf/extra/httpd-vhosts.conf

to

#Include conf/extra/httpd-vhosts.conf

and restart all services

Jesus answered 12/1, 2014 at 16:3 Comment(2)
where i have to do this ?Osier
This is done in apache/conf/httpd.conf but this didn't work for me.Polygamous
D
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>
Dover answered 4/3, 2021 at 17:35 Comment(1)
This actually worked, can anyone explain these permissions?Luce
P
11

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
Postmeridian answered 14/4, 2022 at 15:33 Comment(0)
M
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.

Mccollum answered 5/8, 2014 at 17:33 Comment(0)
N
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.

Nerissanerita answered 2/7, 2016 at 18:50 Comment(4)
#24498249Nerissanerita
I tried your suggestion. I still get The requested URL /login was not found on this server. Arteriovenous
restart the server after the modificationNerissanerita
I did. And I still see that error and I declare that route on my application already.Arteriovenous
V
2

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.

Venter answered 6/3, 2023 at 8:50 Comment(0)
V
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.

Viperish answered 17/9, 2013 at 16:32 Comment(1)
What I did to rename my .htaccess was open my command prompt and execute the following. Rename c:\wamp\www\app\htaccess.txt .htaccessLurk
C
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 :)

Complexion answered 22/6, 2017 at 23:8 Comment(0)
I
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.

Irredentist answered 15/7, 2020 at 9:15 Comment(0)
C
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
Cardiovascular answered 22/7, 2017 at 10:53 Comment(0)
A
0

Make sure your default apache2.conf file atleast looks like this: Config file default location is**/etc/apache2/apache2.conf**

<Directory />
        Options FollowSymLinks
        AllowOverride All
        Require all granted
</Directory>

<Directory /usr/share>
        AllowOverride None
        Require all granted
</Directory>

<Directory /var/www/>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
</Directory>
Armlet answered 1/7 at 9:32 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.