My new permalinks continue displaying a 404 error on my site even after adding the AllowOverride and Rewrite modules parameters. Here is my default-ssl.conf file :
<IfModule mod_ssl.c>
<VirtualHost _default_:443>
ServerAdmin vincent.zzz#gmail.com
DocumentRoot /var/www/zzz
ServerName zzz.com.vn
ServerAlias www.zzz.com.vn
<Directory "/var/www/zzz">
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
<Location />
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
</Location>
#end of custon stuff.....
And here is the normal http part of my apache2.conf file :
<VirtualHost *:80>
ServerName zzz.com.vn
DocumentRoot /var/www/zzz
<Directory "/var/www/zzz">
Options FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
DirectoryIndex index.php
#force SSL
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=permanent]
</Directory>
Would anyone have an idea ?
Are you sure that mod_rewrite is enabled? Is there a symbolic link to rewrite.load in /etc/apache2/mods-enabled?
You can enable the mod with:
sudo a2enmod rewrite
Related
I'm getting the proxy_fcgi:error] AH01071: Got error 'Primary script unknown' error very frequently. Can anyone tell me what causing this error. What I learned so far is Rewrite rule may cause this issue. But do not understand exactly what causing this issue. Following are my Rewrite rules:
<VirtualHost *:80>
ServerName example.com
ServerAlias www.example.com
ServerAdmin webmaster#localhost
DocumentRoot /var/www
<Directory /var/www/>
Options -Indexes +FollowSymLinks -MultiViews
AllowOverride None
Require all granted
# Setting rewrite rules
RewriteEngine on
RewriteBase /
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} !^www\.example\.com [NC]
RewriteRule (.*) https://www.example.com/$1 [R=301,L]
# Show 404 error if there is any slash after page name
RewriteRule ^.+?\.(php|html?)/ - [L,R=404,NC]
# Custom Directory Index Files
DirectoryIndex index.php index.html
</Directory>
</VirtualHost>
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerName example.com
ServerAlias www.example.com
ServerAdmin webmaster#localhost
DocumentRoot /var/www
<Directory /var/www/>
Options -Indexes +FollowSymLinks -MultiViews
AllowOverride None
Require all granted
# Setting rewrite rules
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} ^example.com$ [NC]
RewriteRule (.*) https://www.example.com/$1 [R=301,L]
# Show 404 error if there is any slash after page name
RewriteRule ^.+?\.(php|html?)/ - [L,R=404,NC]
# Custom Directory Index Files
DirectoryIndex index.php index.html
</Directory>
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/example.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/example.com/privkey.pem
</VirtualHost>
</IfModule>
Hello I have a WordPress site and I changed the paramlinks from plain to post name. All my posts are showing 404 not found. I tried to check all possible causes but I could not find why it is not working.
My .htaccess is as below:
# 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
Apache mode rewrite is enabled, the command a2enmod rewrite gives:
Module rewrite already enabled
PHP info shows mod_rewrite in Loaded Modules.
My vhost is as following:
<VirtualHost *:80>
ServerName mysite.com
ServerAlias www.mysite.com
ServerAdmin webmaster#mysite.com
DocumentRoot /var/www/mysite/public_html
ErrorLog /var/www/mysite/logs/error.log
CustomLog /var/www/mysite/logs/access.log combined
<Directory "/var/www/mysite/public_html">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
Any help on this please? Thanks.
I try to force all urls to https except one url. so far no success. Anyone knows what is wrong with my htaccess or codeignter?
Url test 1:
http://hub-dev-1.andatech.com.au/utility/mandrills/email_bounced_back
Should stays as
http://hub-dev-1.andatech.com.au/utility/mandrills/email_bounced_back
Url test 2:
http://hub-dev-1.andatech.com.au/controller/method
I use this tool to test htaccess: http://htaccess.mwl.be/
Here is my htaccess
RewriteOptions inherit
RewriteEngine on
RewriteCond %{HTTPS} !=on
RewriteCond %{REQUEST_URI} !^/utility/mandrills/email_bounced_back
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{REQUEST_URI} !^/(assets|test)/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.*)$ index.php/$1 [PT,L]
Header set Access-Control-Allow-Origin "*"
Test on http://htaccess.mwl.be, working.
Test on browser,
http://hub-dev-1.andatech.com.au/utility/mandrills/email_bounced_back redirects to
https://hub-dev-1.andatech.com.au/utility/mandrills/email_bounced_back
apache conf:
<VirtualHost *:80>
ServerAdmin test#test.com
ServerName hub-dev-1.andatech.com.au
ServerAlias www.hub-dev-1.andatech.com.au
DocumentRoot /home/thehub/public_html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory /home/thehub/public_html>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
# Hak apache 2.2
# Order deny,allow
Allow from all
# Hak apache 2.4
Require all granted
</Directory>
</VirtualHost>
ssl apache conf
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerAdmin test#test.com
ServerName hub-dev-1.andatech.com.au
ServerAlias www.hub-dev-1.andatech.com.au
DocumentRoot /home/thehub/public_html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory /home/thehub/public_html>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
# Hak apache 2.2
# Order deny,allow
Allow from all
# Hak apache 2.4
Require all granted
</Directory>
SSLCertificateFile /etc/letsencrypt/live/hub-dev-1.andatech.com.au/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/hub-dev-1.andatech.com.au/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
</IfModule>
I want use mod_rewrite but seems that is not working, I activated it and I setup in my .htaccess but nothing seems to work.
I want to NOT display index.php in my URL :
instead of
localhost/index.php/admin/login
I want to display
localhost/admin/login
I am under Ubuntu
Here is what my phpinfo() says :
This is my .htaccess :
# Make sure directory listing is disabled
Options +FollowSymLinks -Indexes
RewriteEngine on
#RewriteBase /virtualpost
RewriteCond %{HTTP_HOST} ^localhost$
RewriteRule . - [E=REWRITEBASE:/virtualpost]
#RewriteBase /
RewriteCond %{HTTP_HOST} ^((?!localhost).)*$
RewriteRule . - [E=REWRITEBASE:/]
# Remove index.php from URL
RewriteCond %{HTTP:X-Requested-With} !^XMLHttpRequest$
RewriteCond %{THE_REQUEST} ^[^/]*/index\.php [NC]
RewriteRule ^index\.php(.*)$ $1 [R=301,NS,L]
# Keep people out of codeigniter directory and Git/Mercurial data
RedirectMatch 403 ^/(system\/virtualpost\/cache|system\/codeigniter|\.git|\.hg).*$
# Send request via index.php (again, not if its a real file or folder)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
<IfModule mod_php5.c>
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
<IfModule !mod_php5.c>
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
This is my /etc/apache2/sites-available/000-default.conf :
<VirtualHost *:80>
SetEnv MYSQL_DB_HOST localhost
SetEnv MYSQL_USER root
SetEnv MYSQL_PASSWORD spaces
SetEnv MYSQL_DB_NAME clevvermail
<Directory ...>
AllowOverride All
</Directory>
DocumentRoot /var/www
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
LoadModule rewrite_module modules/mod_rewrite.so
</VirtualHost>
I figured out that I had to config the apache2.conf file /etc/apache2/apache2.conf and change
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride None <<-- Rewriting desactivated
Require all granted
</Directory>
to
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All <<--Activate rewriting
Require all granted
</Directory>
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>