On Live server, to resolve 404 error when trying to access any page, changed below setting in httpd.conf
<Directory "/usr/local/apache/htdocs">
Options Includes Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>
But on next day it gets reset to below
<Directory "/usr/local/apache/htdocs">
Options Includes Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
Really hoping that it was going to work, but no go. This is what .htaccess looked like after I changed the permalink option:
<Directory />
Options +FollowSymLinks
AllowOverride All
</Directory>
<Files .htaccess>
order allow,deny
deny from all
</Files>
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
The pages are still not accessible. Changing AllowOverride None to AllowOverride All works, but it resets again to default setting somehow.
404 page not found error appears often even after changing httpd.conf and .htaccess.
Note: mod_rewrite is already installed
Related
I am sending a website live and I was getting a 500 internal Error.
So I have googled around and I have been able to find a solution.
I have added modifications to the code below.
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_URI} !^/public/index.php
RewriteRule ^(.*)$ /public/index.php/$1 [L]
</IfModule>
The issue is that, when I enter an URL such as www.app.com, I obtain www.app.com/public/index.php
Is there a way to update the .htaccess so that requests made to www.app.com will be redirected to www.app.com/public/index.php without showing /public/index.php in the URL?
Try modifying /etc/apache2/sites-available/default (default location on most Linux distributions, yours may be different).
Change AllowOverride None to AllowOverride All so you should have:
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
<Directory /var/www>
Options FollowSymLinks
AllowOverride All
Order Allow,Deny
Allow from all
</Directory>
Then restart apache with systemctl restart apache2.
the problem is that my wordpress website works but the pages give a 404 page not found error , so i followed these steps :
enabled mod_rewrite
my .htaccess file looks like this :
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
3- when i edit the value in /etc/apache2/apache2.conf
<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>
the website crashes whenever i change the above value , i also tried to re install my apache server and nothing seems to work .
I have set up a server on my Mac (OSX 10.9) but it's returning a 500 error with the following message in the error log…
[alert] [client ::1] /Users/user/Sites/mysite/.htaccess: AllowOverride not allowed here
Here's the code in my .htaccess file
Options +FollowSymLinks -MultiViews
AllowOverride All
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /
RewriteMap lc int:toLower
RewriteCond %{REQUEST_URI} [A-Z]
RewriteRule (.*) ${lc:$1} [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^i/(.*)/(.*)-(.*)$ /items/?id=$1&range=$2&type=$3 [L,QSA,NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^c/(.*)$ /category/?menu=$1 [L,QSA,NC]
And here's the relevant httpd.conf code (let me know if there's anything else that would help)
DocumentRoot "/Users/user/Sites/mysite"
<Directory />
Options FollowSymLinks
AllowOverride All
Order deny,allow
Deny from all
</Directory>
<Directory "/Users/user/Sites/mysite">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>
Any ideas?
AllowOverride All doesn't belong in the htaccess file. It's used in the server config (httpd.conf) to set what an server config parameters an htaccess file can override. So obviously, it would be wrong to be able to configure what parameters htaccess files can override from within htaccess files.
Remove it from your htaccess file. You've already defined AllowOverride All in your httpd.conf in the right places.
AllowOverride controls .htaccess security and behaviour and cannot be set inside of .htaccess itself.
Remove AllowOverride All from the .htaccess file, that's all.
Take AllowOverride All out of your .htaccess file.
I am a begginer in Laravel and I am having troubles with Apache 2.2.15 on CentOS 6.5 and Laravel 5. I have searched for this error and I found some solutions for .htaccess and for httpd.conf but none of them are working and i get this error when trying to access "public/auth/register" or "public/auth/login" and even "/home":
Not Found
The requested URL /index.php was not found on this server.
Here is my .htaccess:
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
And here is my httpd.conf
<Directory "/var/www/html">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
The only page that works is the public/index.php
You have to point apache to the public folder:
<VirtualHost *:80>
DocumentRoot /var/www/html/public
<Directory "/var/www/html/public">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
I added this rule to my (htaccess) file on my root web server so that should anyone try to access lets say /web server/test then index would take the 'test' input as string but it is not working it keeps on saying error 404 not found.
My code is below:
<IfModule mod_deflate.c>
SetOutputFilter DEFLATE
</IfModule>
php_flag magic_quotes_gpc off
RewriteEngine on
RewriteRule ^([^./]{3}[^.]*)$ /index.php?page=$1 [QSA,L]
Are there any faults in this?
Below is my apache2 conf file.... As I get error 500 after changing my settings to override all.
Now I am getting error 500 ... so that I can provide more information... below is my htaccess file code
<IfModule mod_deflate.c>
SetOutputFilter DEFLATE
</IfModule>
php_flag magic_quotes_gpc off
RewriteEngine On
RewriteRule ^([^./]{3}[^.]*)$ /index.php?page=$1 [QSA,L]
And my apache2.conf file.....
<Directory />
Options FollowSymLinks
AllowOverride All
#Require all denied
Order allow,deny
Allow from all
</Directory>
<Directory /usr/share>
AllowOverride All
Order allow,deny
Allow from all
Require all granted
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
Require all granted
</Directory>
two key points you need attention .
ensure your root directory can be overwrite by apache , please check the apache configuration , correct setting by below:
<Directory />
Options FollowSymLinks Multiviews
#AllowOverride none
AllowOverride All
Order allow,deny
Allow from all
# Require all denied
</Directory>
check your rewrite rules and ensure them can work. On your case i test following rules and work fun on my local.
RewriteEngine On
RewriteRule ^(\w+)$ /index.php?page=$1 [L]
Hope this can help you!