Problems with httpd.conf configuration and .htaccess for WordPress - wordpress

I've a problem with a Wordpress Multisite. I've changed the hosting server (dedicated server): the main site works fine but the other site (in subfolder configuration) gives me a 404 error. Searching in the internet documentation, I've read that is necessary to change the AllowOverride directive in httpd.conf but when I change this from None to All (and then restart the Apache server) the entire site (main e subfolder's) gives back an Internal Server Error. I tried many different configuration with "main" directory and virtualhost directory but without succes.
I write here the code of http.con
<Directory "/var/www/html">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.2/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride None
#
# Controls who can get stuff from this server.
#
Order allow,deny
Allow from all
</Directory>
<VirtualHost *>
ServerName www.domain.com
DocumentRoot /var/www/html/www.domain.com
<Directory /var/www/html/www.domain.com>
#AllowOverride All
#AllowOverride Fileinfo Options
</Directory>
</VirtualHost>
What can I do to make it works?
PS. Also if I change only AllowOverride from None to All in (and no other changes) the page give an Internal Server Error.

Related

editing httpd.conf on apache

I'm trying to make my apache visible on my local network for being able to acces my wordpress site hosted there, by editing httpd.conf file on /bin/apache/conf/ and im getting a Permision Error, but I can't find any clear content on the Internet.
Im using UWAMP 3.1.0 and It must be something related with this part of the code:
<VirtualHost *:80>
#UWAMP Generate Virtual Host
DocumentRoot "F:/UwAmp/www/"
ServerName "main-serveur"
Alias "/mysql/" "F:/UwAmp/phpapps/phpmyadmin/"
Alias "/mysql" "F:/UwAmp/phpapps/phpmyadmin/"
Alias "/uwamp/" "F:/UwAmp/phpapps/uwamp/"
Alias "/uwamp" "F:/UwAmp/phpapps/uwamp/"
<Directory "F:/UwAmp/phpapps/phpmyadmin/">
AllowOverride All
Options FollowSymLinks Includes Indexes
Require local
</Directory>
<Directory "F:/UwAmp/phpapps/uwamp/">
AllowOverride All
Options FollowSymLinks Includes Indexes
Require local
</Directory>
<Directory "F:/UwAmp/www/">
AllowOverride All
Options FollowSymLinks Indexes
Require local
</Directory>
more concretely at the end:
<Directory "F:/UwAmp/www/">
AllowOverride All
Options FollowSymLinks Indexes
Require local
</Directory>
This is what I get after entering the IP where the site is hosted.
sorry for asking something so simple but I'm learning
Thank you in advance
{ONLINE_MODE}
If UwAmp is on Online mode, your website is available for all.
{ONLINE_MODE} will be replaced by :
Order allow,deny
Allow from all
If UwAmp is on Offline mode, your website is available only for your computer.
{ONLINE_MODE} will be replaced by :
Order deny,allow
Allow from 127.0.0.1 localhost

How to access to a localhost from another machine in the same network? [duplicate]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 4 years ago.
Improve this question
All I wanted to do today was to write a redirect rule to a subfolder, e.g.:
You enter the URL: example.com and you get redirected to example.com/subfolder
Such a simple wish. I tried to find a solution on the internet. The internet told me to add an .htaccess file in the htdocs root with:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^example\.com$
RewriteRule (.*) http://www.example.com/$1 [R=301,L]
RewriteRule ^$ subfolder [L]
I did this. But no success obviously, they didn't told me I had to uncomment the module in httpd.conf:
LoadModule rewrite_module modules/mod_rewrite.so
So I did this too. No success again. They didn't told me I had to change my httpd.conf so that the .htaccess file would be enabled:
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
</Directory>
DocumentRoot "c:/Apache24/htdocs"
<Directory "c:/Apache24/htdocs">
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
Again no success, because I get this error when entering the URL:
Forbidden You don't have permission to access / on this server.
Now I'm stuck and I couldn't find any more solutions on the internet. I'm just running Apache 2.4 on my Windows 7 machine, for private reasons.
Found my solution thanks to Error with .htaccess and mod_rewrite
For Apache 2.4 and in all *.conf files (e.g. httpd-vhosts.conf, http.conf, httpd-autoindex.conf ..etc) use
Require all granted
instead of
Order allow,deny
Allow from all
The Order and Allow directives are deprecated in Apache 2.4.
WORKING Method { if there is no problem other than configuration }
By Default Appache is not restricting access from ipv4. (common external ip)
What may restrict is the configurations in 'httpd.conf' (or 'apache2.conf' depending on your apache configuration)
Solution:
Replace all:
<Directory />
AllowOverride none
Require all denied
</Directory>
with
<Directory />
AllowOverride none
# Require all denied
</Directory>
hence removing out all restriction given to Apache
Replace Require local with Require all granted at C:/wamp/www/ directory
<Directory "c:/wamp/www/">
Options Indexes FollowSymLinks
AllowOverride all
Require all granted
# Require local
</Directory>
Solution is just simple.
If you are trying to access server using your local IP address and you are getting error saying like Forbidden You don't have permission to access / on this server
Just open your httpd.conf file from (in my case C:/wamp/bin/apache/apache2.2.21/conf/httpd.conf)
Search for
<Directory "D:/wamp/www/">
....
.....
</Directory>
Replace
Allow from 127.0.0.1
to
Allow from all
Save changes and restart your server.
Now you can access your server using your IP address
The problem lies in https.conf file!
# Virtual hosts
# Include conf/extra/httpd-vhosts.conf
The error occurs when hash(#) is removed or messed around with. These two lines should appear as shown above.
Found my solution on Apache/2.2.15 (Unix).
And Thanks for answer from #QuantumHive:
First:
I finded all
Order allow,deny
Deny from all
instead of
Order allow,deny
Allow from all
and then:
I setted
#
# Control access to UserDir directories. The following is an example
# for a site where these directories are restricted to read-only.
#
#<Directory /var/www/html>
# AllowOverride FileInfo AuthConfig Limit
# Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
# <Limit GET POST OPTIONS>
# Order allow,deny
# Allow from all
# </Limit>
# <LimitExcept GET POST OPTIONS>
# Order deny,allow
# Deny from all
# </LimitExcept>
#</Directory>
Remove the previous "#" annotation to
#
# Control access to UserDir directories. The following is an example
# for a site where these directories are restricted to read-only.
#
<Directory /var/www/html>
AllowOverride FileInfo AuthConfig Limit
Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
<Limit GET POST OPTIONS>
Order allow,deny
Allow from all
</Limit>
<LimitExcept GET POST OPTIONS>
Order deny,allow
Deny from all
</LimitExcept>
</Directory>
ps. my WebDir is: /var/www/html
This works for me on Mac OS Mojave:
<Directory "/Users/{USERNAME}/Sites/project">
Options +Indexes +FollowSymLinks +MultiViews
AllowOverride All
require all granted
</Directory>

Wordpress permalink not working on aws

I have spent 4-5 hours to sort it out but not able to solve it.
I have setup my wordpress website on AWS.Everything is working file except the permalinks of wordpress.
When permalinks are set to default pages/posts are working but not working with "%post-name%".
I have tried almost all the things by searching over google but no success.
I saw so many solutions all related to httpd.conf file but on my root there is no file httpd.conf neither no directory of http.
I changed the following code in apache.conf file but still not working
<Directory />
Options FollowSymLinks
AllowOverride All
Require all denied
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
Restarted apache again and again but no luck.
Please help me guys.
Thanks.
I've just managed to fix this error. Make sure you restart Apache service after making the httpd.conf change!
Documentation here has a checklist of all the changes you need to get wordpress working correclty on AWS - including getting permissions correct: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/hosting-wordpress.html
The bit you need to fix for permalinks is tp update the httpd.conf file
(1) Location: /etc/httpd/conf/httpd.conf
(2) Find the section that starts with <Directory "/var/www/html">
<Directory "/var/www/html">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.4/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride None
#
# Controls who can get stuff from this server.
#
Require all granted
Change the AllowOverride None line in the above section to read AllowOverride All
Note
There are multiple AllowOverride lines in this file; be sure you change the line in the section.
AllowOverride All
(3) Restart the Apache service
If you dont have much experience using aws, then i guess its because you have not granted enough permissions to your apache. If you are unware of how to grant permissions to your apache, you can use this command in your console
sudo CHOWN -R apache:apache /var/www/html
Once done try going to your settings page and saving the new settings.

Magento doubled base url in CSS paths

I'm migrating to other server, and in the new server I got this error, the path to all css files are wrong, the js paths are fine, everything else is fine.
Path magento return through getCssJsHtml():
/var/www/domain.com/public/http://domain.com/public/skin/frontend/fortis/default/css/style.css
The path that getSkinUrl() function returns is correct.
Changed the base_url (secure and unsecure) to the new one.
merge_files are 0
cleaned the cache (rm -rf * in var/).
Tried to change ownership of media and var folders to www-data, didn't work as well.
I'm using Fortis theme.
I have GTSpeed extension installed, if I disable it, the head tag shows empty.
If I enable css and js compression in GTSpeed I get a 400 Bad request error.
The admin section always works fine, only thing I noticed is if I change the Link Base Url in Configuration >> Web, I got an 404 error when saving. But I can change all other fields and it saves as expected.
The vhost configuration:
<VirtualHost *:80>
ServerAdmin webmaster#localhost
<Directory "/var/www/domain.com/public">
Options All
AllowOverride All
Order allow, deny
Allow from all
</Directory>
RewriteEngine on
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
Check what your secure and unsecure urls have trailing slash: http://domain.com/
The same for skin, js, css paths: {{unsecure_base_url}}skin/
After that check your .htaccess file, especially RewriteEngine and RewriteBase params. In most cases next values working fine:
Options All
RewriteEngine on
RewriteBase /
If you use Apache vhosts, check vhost config. In VirtualHost section you need next lines:
<VirtualHost>
...
<Directory "/var/www/domain.com/public">
Options All
AllowOverride All
Order allow,deny
Allow from all
</Directory>
RewriteEngine On
...
</VirtualHost>

Drupal vhost file not displaying website content

I have used virtualhost file in drupal to create multiple sites under one server. Also to remove /drupal from the url.
ex: 202.45.198.98/drupal this is how my URL looks like when ever I visit my website
After creating new Virtual host file for my website, I can see my website without /drupal in url.
Now the problem only the first page is loaded I mean some matter but not images, drupal template or any other links.
<VirtualHost *:80>
ServerAdmin webmaster#localhost
ServerName mysite
DocumentRoot /var/www/drupal
<Directory /var/www/drupal/>
Options FollowSymLinks
AllowOverride All
Order allow,deny
allow from all
</Directory>
<Directory /var/www/drupal/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin/">
AllowOverride All
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog /var/log/apache2/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog /var/log/apache2/access.log combined
Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride All
Order deny,allow
Allow from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
</VirtualHost>
You should check the settings.php inside sites/default folder. You will see a line something like --
# $base_url = 'http://www.example.com'; // NO trailing slash!
Remove the hash at the start & update the URL with the current URL you have for the drupal instance. Most probably you will solve your problem if your connection setting is correct at the same settings.php file (DB name, server name, username & password).
If you find problem due to clean URL in logging in then you may have to put manual path for logging in as admin, which will be --
YOUR_BASE_URL/?q=user/login
If you want to disable clean URL then you can write a extra line in your settings.php --
$conf = array(
'clean_url' => 0,
);
Have nice drupling :)

Resources