In my attempt to get my Drupal alias links to work I have narrowed it down to the fact that the mod_rewrite module is not installed. I uncommented the LoadModule rewrite_module libexec/apache2/mod_rewrite.so as well as LoadModule php5_module libexec/apache2/libphp5.so. I have also changed AllowOverride None to AllowOverride All in every instance it appears in the httpd.conf file. I then restarted apache and I still cannot run this command: sudo a2enmod rewrite. Everytime I run it I get command not found error. What am I doing wrong, my username.conf also has the code listed below.
<Directory "/Users/username/Sites/">
Options Indexes MultiViews FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
Any help would very appreciated.
Tyler
Go to the terminal and type sudo apachectl stop and then sudo apachectl start and see what happens.
Related
I have tried many solutions which are given in Stack Overflow and it's not working anymore. My Magento version is 1.5. Why am I getting this issue after I tried all the solution for admin?
make sure that you have used index.php in url before admin route name.This is needed if url rewrites are enabled.
index.php before /admin or any suffix you have
For Ubuntu edit the file /etc/apache2/apache2.conf
To edit this file use
sudo vi /etc/apache2/apache2.conf command
<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>
After this run command
sudo service apache2 restart
IF STILL ADMIN SHOW 404 NOT FOUND, Add htaccess file
1) Add .htaccess at root of magento
I need to include a folder on my httpd.conf that is out of my DocumentRoot directory. I know there is a lot of info about this but not specifically for Apache 2.4 running on Windows. I tried a lot of things but anything works, I always get a forbidden error, and this is driving me mad.
Here is my default config made by WAMP:
<Directory />
AllowOverride none
Require all denied
</Directory>
DocumentRoot "${INSTALL_DIR}/www"
<Directory "${INSTALL_DIR}/www/">
Options +Indexes +FollowSymLinks +Multiviews
AllowOverride all
Require local
</Directory>
That's OK but I need to include a folder project on my E:\ disk.
I have tried all of these, obviously restarting the apache server after every attempt:
Attempt #1
<Directory "e:/Development/[Git]/projectName/public/">
Require all granted
</Directory>
Attempt #2
<Directory "e:/Development/[Git]/projectName/public/">
Options +Indexes +FollowSymLinks +Multiviews
AllowOverride all
Require local
</Directory>
Attempt #3
Alias /projectName "e:/Development/[Git]/projectName/public/"
# The <Directory> on attempts #1 and #2
Just to clarify:
I have tried a lot of combinations using / or \. Also using " or without. I even tried to escape the [] like this \[Git\].
I already have a VirtualHost well configured for that directory. I know it because if I remove the security on the <Directory /> then works fine, but as I have read this is a lack of security that I do not want to have:
# Disabling the security as below is not an option
<Directory />
AllowOverride none
Require all granted
</Directory>
Can anyone help me please? Thanks in advance
I'm starting to learn how to set up a lamp on a vps, and i'm trying to run a laravel project.
This is my 000-default.conf
<VirtualHost *:80>
ServerAdmin webmaster#localhost
DocumentRoot /var/www/html
Alias /laravelproject /var/www/laravelproject/public
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
I'm trying to access using the /laravelproject and it works cause i'm redirected to a login page ip/laravelproject/login (like I set using the middleware for not logged users and it works on my local homestead virtual machine). But i got a 404 file not found error. Not a pretty designed laravel one, but a raw and ugly server error
Not Found
The requested URL /laravelproject/login was not found on this server.
Apache/2.4.10 (Ubuntu) Server at '' Port 80
Of course i don't have any laravelproject.com domain to set up, i want to access it simply with my_server_ip/laravelproject.
How can i set up a virtualhost or an alias to run it with all the routes working?
You could also try enabling apache mod-rewrite if not enabled yet.
sudo a2enmod rewrite
sudo systemctl restart apache2
You'll need to make sure the /var/www/laravelproject/public directory is set to AllowOverride All (which I believe you have taken care of by setting /var/www to All). Then make sure the .htaccess file in your public directory is correctly set up: https://github.com/laravel/laravel/blob/master/public/.htaccess
this is because Apache is looking for /public/login/index.html which is not a file. Laravel's .htaccess redirects these requests appropriately, but it has to be in your public folder and Apache has to AllowOverride
edit:
<Directory /var/www/laravelproject/public>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
</Directory>
I have clean installed Mac OSX Yosemite but I cant configure the Apache 2.4 like I have always done on older OSX versions.
Here is what I want to do : set the "localhost" directory to "/Users/username/Public/".
But, everything I tried won't work, I always get a "Forbiden, can't access to /" or I get the default "It works!" page...
How to simply reroot my localhost ?
Thx
EDIT (thanks to Krister Andersson for the answer)
For Mac OSX 10.10 Yosemite
I also post the changes I had to do to keep things running.
In "/etc/apache2/users/", I created a file named by my username like this "myUsername.conf".
You can get your username by typing "id" in terminal. You should find your username at start in "uid=501(myUsername)".
In this new "myUsername.conf" file, just copy past this:
<Directory "/Users/myUsername/Sites/">
AllowOverride All
Options Indexes MultiViews
Options +FollowSymLinks
Require all granted
</Directory>
Dont forgive to change the myUsername value.
Then, in the "/etc/apache2/httpd.conf" file, uncomment all these two lines:
167 #LoadModule userdir_module libexec/apache2/mod_userdir.so
169 #LoadModule php5_module libexec/apache2/libphp5.so
Line 236, change the directory of "DocumentRoot" to whatever you want.
Line 250, set "Options" to "Options "Options Indexes FollowSymLinks Multiviews".
Line 258, set "AllowOverride None" to "AllowOverride All".
Line 263, set "Require all denied" to "Require all granted"
In Terminal, restart apache by typing "sudo apachectl restart".
It work's for me on Mac OS X 10.10 Yosemite clean install.
I've just installed Yosemite and I managed to change the DocumentRoot without any problems. First I modified the following lines in /private/etc/apache2/httpd.conf:
DocumentRoot "/Library/WebServer/Documents"
<Directory "/Library/WebServer/Documents">
Options FollowSymLinks Multiviews
AllowOverride None
</Directory>
to:
DocumentRoot "<CUSTOM_PATH>"
<Directory "<CUSTOM_PATH>">
Options Indexes FollowSymLinks Multiviews
AllowOverride All
</Directory>
The above will set a custom DocumentRoot, enable directory listing and allow configurations to be overridden by .htaccess files.
Then I restarted apache by executing sudo apachectl restart.
Another approach would be to set up a virtual host. First make sure so that the following line is uncommented in your /private/etc/apache2/httpd.conf file:
# Virtual hosts
#Include /private/etc/apache2/extra/httpd-vhosts.conf
Then you can add the following in the httpd-vhosts.conf file:
<VirtualHost *:80>
ServerAdmin webmaster#example.local
DocumentRoot "/Library/WebServer/Documents"
ServerName example.local
ErrorLog "/private/var/log/apache2/example.local-error_log"
CustomLog "/private/var/log/apache2/example.local-access_log" common
<Directory "/Library/WebServer/Documents">
Options Indexes FollowSymLinks Multiviews
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
The above will setup a document root for a new virtual host named example.local and enable directory listing and allow configurations to be overridden by .htaccess files. Of course your also will need to restart apache for the changes to take effect:
sudo apachectl restart
On El Capitan you should restart apache with "-k" flag:
sudo apachectl -k restart
I have a basic virtual host setup enabled on my machine, and it works fine when I just type in the server name. However, when I include "RewriteEngine On" it kills it. Yes, I do have the rewrite module installed, and yes, I have restarted apache. I'm not actually attempting any rewrite rules yet, because just the act of turning the thing on is enough to make it stop working. Any clue as to what's going on? Seems like if the module is included, this ought to work. What am I forgetting? Here's what I've got in my virtual host file
NameVirtualHost *:80
<VirtualHost *:80>
ServerAdmin webmaster#localhost
DocumentRoot "C:/www/mysite/public/"
ServerName mysite
RewriteEngine on
<Directory "C:/www/mysite/public/"
Options Indexes FollowSymLinks
AllowOverride all
Order Deny,Allow
Allow from all
</Directory>
</VirtualHost>
When I remove the "RewriteEngine on" line, everything works. When I put it back in, it breaks. I could understand if I had some weird rule in there, but simply turning it on shouldn't break anything.
Perhaps mod_rewrite isn't enabled in your setup? You can try to put the RewriteEngine On line inside an test like so
<IfModule mod_rewrite.c>
RewriteEngine On
</IfModule>
I assume you an Ubuntu-like system.
Go to /etc/apache2/sites-available/your_site.conf
Open your_site.conf using your favorite text editor.
Add/Update the Directory section as below
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
Save it and restart apache.