Magento doubled base url in CSS paths - css

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>

Related

WAMP - vhost address forced to HTTPS instead of just HTTP

I have installed wamp64. configured various vhosts which work well except for one address which the system forces to go to HTTPS instead of HTTP like the rest of them. dev.test.com is forced to go to HTTPS://dev.test.com instead of HTTP://dev.test.com and of course the file is not found.
dev.test2.com goes to HTTP,
example goes to HTTP
I had a XAMPP install that had a vhosts file which had a redirect for dev.test.com to HTTPS. Thinking this might somehow interfere, I renamed that XAMPP vhost file, but I still get the same problem even after a computer reboot.
In wamp64 I am able to create any other vhost and have it work fine, but not this one. What could be causing this?
wamp64, version 3.2.9, php 7.4, apache 2.4.51
WAMP VHOST FILE:
<VirtualHost *:80>
ServerName example
DocumentRoot "c:/wamp64/www/example"
<Directory "c:/wamp64/www/example/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>
#
<VirtualHost *:80>
ServerName dev.test.com
DocumentRoot "c:/wamp64/www/dev.test.com"
<Directory "c:/wamp64/www/dev.test.com/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>
#
<VirtualHost *:80>
ServerName dev.test2.com
DocumentRoot "c:/wamp64/www/dev.test2.com"
<Directory "c:/wamp64/www/dev.test2.com/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>
#
My previous XAMPP VHOST FILE - NOW RENAMED TO DISABLE IT (httpd-vhosts_old.conf)
<VirtualHost dev.test.com:80>
ServerName dev.test.com
DocumentRoot "C:\xampp\htdocs\dev.test.com"
<Directory "C:\xampp\htdocs\dev.test.com">
Options All
AllowOverride All
Require all granted
</Directory>
ErrorLog "logs/dev.test.com-error.log"
CustomLog "dev.test.com-access.log" combined
#redirect non SSL URI to SSL URI
RewriteEngine on
RewriteCond %{SERVER_NAME} =www.dev.test.com [OR]
RewriteCond %{SERVER_NAME} =dev.test.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
I ended up configuring a local SSL certificate for the server and converted all local hostnames to access SSL which worked fine. I know this does not answer the posted question, but at least allowed me to proceed.

VirtualHost sets the url as abc.com/subdirectory/

<VirtualHost *:80>
ServerAdmin xxx#abc.com
ServerName abc.com
ServerAlias www.abc.com
DocumentRoot /var/www/html/wordpress/
<Directory /var/www/html/wordpress/>
Options All
AllowOverride All
order allow,deny
allow from all
</Directory>
ErrorLog /var/logs/error_wp.log
CustomLog /var/logs/access_wp.log combined
</VirtualHost>
I had issues with Wordpress url, then I changed the url to abc.com and now Wordpress renders all pages correctly.
But when it comes to homepage, abc.com, it redirects to abc.com/wordpress/
So whenever I type abc.com in a browser, it redirects to abc.com/wordpress/
And it says "Oops! That page can’t be found."
Wonder where the issue might be.
I'm using default .htaccess for Wordpress. I use a static homepage. Except homepage all other pages work properly. I am able to login using abc.com/wp-admin/
Thanks in advance.
Your directory block should list the path relative to the root, not the absolute path. See if this fixes it:
<Directory />
Options All
AllowOverride All
order allow,deny
allow from all
</Directory>
Also, you shouldn't include a trailing slash with your document root.
DocumentRoot /var/www/html/wordpress
Here's the entire corrected config file:
<VirtualHost *:80>
ServerAdmin xxx#abc.com
ServerName abc.com
ServerAlias www.abc.com
DocumentRoot /var/www/html/wordpress
<Directory />
Options All
AllowOverride All
order allow,deny
allow from all
</Directory>
ErrorLog /var/logs/error_wp.log
CustomLog /var/logs/access_wp.log combined
</VirtualHost>
The problem was pretty silly. I had set a static page as homepage, which had an entry in db as abc.com/wordpress/. So everytime I click homepage, it would search for abc.com/wordpress/wordpress, which doesn't actually exist.

Redmine in subfolder. Drupal (in main folder) handles all requests

I have Redmine in subfolder /var/www/redmine and Drupal in folder /var/www/
When I go to URL mysite.com/redmine, Redmine shows ok, but mysite.com/redmine/login is (over)handled by Drupal.
Apache config is as follows
<VirtualHost *:80>
ServerAdmin webmaster#localhost
DocumentRoot /var/www
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
RailsBaseURI /zoo-redmine
PassengerResolveSymlinksInDocumentRoot on
Options Indexes FollowSymLinks -MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
It seems a Drupal configuration issue. Try to look in your Drupal configuration panel to exclude from Drupal's login system the /redmine/ subfolder. I can't point you to the exact url because my drupal configuration uses CAS, but it is probably in
Start -> Administration -> Configuration -> People
It was as simple as RewriteRule ^zoo-redmine - [L] before other rewrites in .htaccess
This code exits .htaccess file if encounters zoo-redmine string and don't allow Drupal to readdress this request to index.php with arguments

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 :)

Apache2 Setup Ubuntu

I'm having problems with setting up my apache2 server in Ubuntu.
I did a sudo apt-get install and it installed normally. I was able to see that the site was working when accessing localhost.
Then I'm not sure what happened, but I am no longer able to see the "It works!" website. When I try to restart apache2, it returns this:
Syntax error on line 17 of /etc/apache2/sites-enabled/000-default:
AddHandler requires at least two arguments, a handler name followed by one or more file extensions
Action 'configtest' failed.
The Apache error log may have more information.
...fail!
Any ideas?
Here is my /etc/apache2/sites-enabled/000-default:
ServerAdmin webmaster#localhost
DocumentRoot /var/www
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
DirectoryIndex index.html index.py
AddHandler mod_python.py
PythonHandler mod_python.publisher
PythonDebug On
</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
There is a problem on your config file. Try changing the line 14 by :
AddHandler mod_python .py

Resources