htaccess rewrite stopped working after update - php

I am using this code in my htaccess file, and I am confident that it is right, but it is not working on my new server. You can find my phpinfo file here: http://www.saint57records.com/test.php. I just updated my apache, so I don't know if it is something there. I have tried finding other information but I can't find any.
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/artists/index.php.*
RewriteRule ^artists/(.+)$ artists/index.php?artist=$1 [L]

Check httpd.conf or apache2.conf inside , AllowOverride must be set to All
If you are using Ubuntu check this in /etc/apache2/apache2.conf
<Directory /your/directory>
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>

Related

Phabricator install. Rewrite rules are not configured correctly

I've followed the Phabricator Configuration Guide, and after installing all dependencies, I'm facing the following message:
Request parameter '__path__' is not set. Your rewrite rules are not configured correctly.
This message is shown when I try to access www.cleverbit.com.br/phabricator/webroot/
I have a apache2.conf file configured just the way the docs suggested:
<VirtualHost *>
# Change this to the domain which points to your host.
ServerName cleverbit.com.br
# Change this to the path where you put 'phabricator' when you checked it
# out from GitHub when following the Installation Guide.
#
# Make sure you include "/webroot" at the end!
DocumentRoot /var/www/html/phabricator/webroot
RewriteEngine on
RewriteRule ^(.*)$ /index.php?__path__=$1 [B,L,QSA]
</VirtualHost>
<Directory />
Options FollowSymLinks
AllowOverride All
Require all denied
</Directory>
<Directory /usr/share>
AllowOverride All
Require all granted
</Directory>
<Directory "/var/www/html/phabricator/webroot">
Require all granted
AllowOverride All
</Directory>
What's exactly wrong with my apache rewrite configuration?
Apache does not have inheritance inside Directory statements, so you also need the AllowOverride All line inside the Directory block for /var/www/html/phabricator/webroot.
To avoid confusion, I would get rid of the /var/www Directory block, unless you have another VirtualHost that uses it (in which case, you might want to move Phabricator out from that directory to avoid accidentally creating back doors).
Setting the following rewrite rules fixed this for me
RewriteEngine on
RewriteRule ^/rsrc/(.*) - [L,QSA]
RewriteRule ^/favicon.ico - [L,QSA]
RewriteRule ^(.*)$ /index.php?__path__=$1 [B,L,QSA]
thanks to https://gist.github.com/sparrc/b4eff48a3e7af8411fc1

XAMPP .htaccess mod_rewrite not working

I am running XAMPP for Windows 5.6.11. I have the following PHP file:
C:\xampp\htdocs\www.johndoe.com\index.php
which I am accessing as
http://localhost/www.johndoe.com/
As a matter of fact I need to access the following page:
http://localhost/www.johndoe.com/?value=about
as either of the following two:
http://localhost/www.johndoe.com/about/
http://localhost/www.johndoe.com/about
so I have the following in my .htaccess file:
RewriteEngine on
RewriteRule ^www\.johndoe\.com/about/?$ www.johndoe.com/?value=about
However, this is not working, as accessing the former sites gives me a 401 (not found).
Here is what I have in C:\xampp\apache\conf\httpd.conf:
<Directory />
AllowOverride none
Require all denied
</Directory>
DocumentRoot "C:/xampp/htdocs"
<Directory "C:/xampp/htdocs">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
</Directory>
What must I do to get my .htaccess file to be parsed and carry out the substitution I'm after?
I have tried placing the following in C:\xampp\apache\conf\httpd.conf:
<Directory />
AllowOverride all
Require all allowed
</Directory>
but have had no luck with it.
I have even tried changing my .htaccess file to the following:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteBase /www.johndoe.com/
RewriteRule ^about/?$ ?value=about
but I'm still getting the 404 not found error message.
As it turns out, with the default XAMPP configuration there is no need to C:\xampp\apache\conf\httpd.conf, hence no need to restart Apache as we are just making changes to C:\xampp\htdocs\www.johndoe.com\.htaccess. As this post on RewriteBase explains, we do not need RewriteBase since we will not use absolute paths in the destination links for .htaccess rules. Since relative links in these destination rules will be relative to the directory we are serving out of, we need delete the www.johndoe.com directory from the rule, as follows:
Place the .htaccess in ``C:\xampp\htdocs\www.johndoe.com`.
Place the following rewiterule in it:
RewriteEngine on
RewriteRule ^about/?$ index.php?value=about

XAMPP httpd.conf setup to allow for mod_rewrite rules

I recently inherited a unfinished CodeIgniter project from a company that has sub-contracted me to complete it. I'm having some trouble with the mod_rewrite rules that the previous dev has implemented as I am unable to view the project on my localhost.
From what I can gather the rules applied are just to get rid of the "index.php" portion of the URL. The project works perfectly live so I believe that the issue lies with the way I have set up my xampp httpd.conf file. As per instructions found on this site and other sources I have mad the following changes to the httpd.conf file:
LoadModule rewrite_module modules/mod_rewrite.so
<Directory />
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
DocumentRoot "C:/Users/Me/Documents/Github"
<Directory "C:/Users/Me/Documents/Github">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
When I go to localhost and click on the project I am just getting a 404 error. I've been struggling with this for a couple of days now and don't know how to proceed. Can you see an issue with the way I've set up the httpd.conf file? Thanks for the help!
EDIT: Added the rewrite rules being used.
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
SetEnv ENVIRONMENT development
This could be a wild guess but when I look at my Xampp apache config it has
..
allow from all
Require all granted
</Directory>

apache 2.4 php and laravel - friendly urls

I have been pulling my hair off since the last few hours trying to get my friendly urls work.
I have apache 2.4 with php set up. the app is built using laravel 4
so while this http://machinename:90/helpsystem/index.php/categories works the following does not work http://machinename:90/helpsystem/categories
I have enabled the mod_rewrite module in apache's httpd.conf file
Also I have added this to my alias module section of the httpd.conf
ScriptAlias /helpsystem "c:/Apache24/htdocs/helpsystem/public"
public being the the public folder of the laravel app
my directory section looks like this
<Directory "c:/Apache24/htdocs/helpsystem/public">
Options Indexes Includes FollowSymLinks MultiViews
AllowOverride AuthConfig FileInfo
Order allow,deny
Allow from all
</Directory>
and the .htaccess file looks like this
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
Can you please let me know what am I doing wrong ?
thanks
AllowOverride All should fix your problem, after restarting apache2
<Directory c:/Apache24/htdocs/helpsystem/public/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
Check out Apache's upgrade guide from 2.2 to 2.4.
Since 2.4+ is shipped out on most linux distros now (particularly Debian/Ubuntu), you'll see this crop up a lot. I see you're on Windows, so it looks like whatever you happen to be using as updated as well! Specifically,
Order allow,deny
Allow from all
Has been replaced with Require all granted as Apache now uses mod_authz_host.

.htaccess file not working on linux

I have configured Amazon EC2 instance with Amazon Linux AMI 64 bit
and I have uploaded my website, whole code is working but issue with .htaccess
RewriteRule are not working. I have done all changes in httpd.conf file but I think it might be a permission issue.
please help me regarding this.
here is my htaccess code
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^friosworld\.com$ [NC]
RewriteRule ^(.*)$ http://www.friosworld.com/$1 [R=301,L]
and one more thing I have found via googling
httpd.conf file code
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
I think problem is in this block of code. but I don't know what is the problem!
I have also changed AllowOverride None to AllowOverride All but still not working!!
Got the solution. thanks for your time.
<Directory />
Options FollowSymLinks
AllowOverride All # AllowOverride None to AllowOverride All
</Directory>
AND
DocumentRoot "/home/mydirectory/website" //change this default path to my path
Now its working fine
Thank you all

Categories