Below is my .htaccess code:
<VirtualHost *:80>
ServerName api.xxxx.com
DocumentRoot /dianxiaoer/html/two-twenty
<Directory /dianxiaoer/html/two-twenty>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php
RewriteRule /notify/alipay /mobile/index.php?act=notify&op=alipay
#Options Indexes FollowSymLinks MultiViews
Options FollowSymLinks
AllowOverride None
Require all granted
Order allow,deny
allow from all
</Directory>
</VirtualHost>
URL rewriting rule
api.xxxx.com/notify/alipay to api.xxxx.com/mobile/index.php?act=notify&op=alipay
is not working correctly. Can anyone please explain what am I doing wrong here? Thanks.
This line, RewriteRule . index.php will override anything that comes after it.
If you put that one at the end then it should sort out your issue.
Try swapping line 8 and 9 like this:
<VirtualHost *:80>
ServerName api.xxxx.com
DocumentRoot /dianxiaoer/html/two-twenty
<Directory /dianxiaoer/html/two-twenty>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule /notify/alipay /mobile/index.php?act=notify&op=alipay [L]
RewriteRule . index.php
#Options Indexes FollowSymLinks MultiViews
Options FollowSymLinks
AllowOverride None
Require all granted
Order allow,deny
allow from all
</Directory>
</VirtualHost>
Hopefully that solves your issue.
Related
I have a laravel 5.4 application in a server, and I get this result when I try to test my app.
My virtual host file
<VirtualHost *:80>
ServerName plataformafoodif.cl
DocumentRoot "/var/www/html/Plataforma-FoodIf/public"
ServerAlias www.plataformafoodif.cl
<Directory "/var/www/html/Plataforma-FoodIf/public">
Options All
AllowOverride All
Allow from all
</Directory>
</VirtualHost>
My index.php file
<?php
require __DIR__.'/../bootstrap/autoload.php';
$app = require_once __DIR__.'/../bootstrap/app.php';
My .htaccess file
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</IfModule>
My hosts file
# Generated by SolusVM
127.0.0.1 localhost localhost.localdomain
::1 localhost localhost.localdomain
# 168.232.167.108 FRESBOX.CL
168.232.167.108 plataformafoodif.cl
Also on my .env I have
APP_ENV=local
APP_DEBUG=true
APP_KEY=someRandomKey
APP_LOG_LEVE=debug
APP_URL=http://168.232.167.108
Any help would be really appreciated, I have spent many hours trying to fix this
Hi there can you try this:-
<VirtualHost *:80>
ServerName plataformafoodif.cl
DocumentRoot "/var/www/html/Plataforma-FoodIf/public"
ServerAlias www.plataformafoodif.cl
<Directory "/var/www/html/Plataforma-FoodIf">
Options All
AllowOverride All
Allow from all
</Directory>
</VirtualHost>
and also you have to configure the apache2.config file.
<Directory />
Options FollowSymLinks
AllowOverride None
Require all denied
</Directory>
<Directory /usr/share>
AllowOverride None
Require all granted
</Directory>
<Directory /var/www/html>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
You will find the above code in your apache2.conf file where you add your path to the third directory.
And then reload the apache server. I hope this helps your problem.
In the end it was this
<IfModule dir_module>
DirectoryIndex index.html
</IfModule>
I've changed to index.php to match my file on public and i also added the php module line
LoadModule php7_module modules/libphp7.so
Thanks your all your help
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 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>
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
Question
I would like to map
www.mydomain.com/some/url
to
C:/xampp/htdocs/some/dir
What I've got
Xampp
Wordpress
htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /some/path/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /some/path/index.php [L]
</IfModule>
Hosts file
127.0.0.1 www.mydomain.com
httpd-vhosts.conf (included in httpd.conf)
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs/someDir/"
ServerName mydomain.com/some/path
</VirtualHost>
additional info (httpd.conf)
DocumentRoot "C:/xampp/htdocs"
<Directory "C:/xampp/htdocs">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
</Directory>
Current Outcome
500 Internal Server Error error log shows
Request exceeded the limit of 10 internal redirects due to probable configuration error.
Add the alias to your httpd.conf
DocumentRoot "C:/xampp/htdocs"
<Directory "C:/xampp/htdocs">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
</Directory>
Alias /some/url C:/xampp/htdocs/some/dir