Categories
apache

.htaccess Forward to New Domain with URL Parameters

If you move your web page to a new domain, you may want to forward users (and search engines in particular) that still access your page via the old domain to the new domain. However, if you use an underlying CMS or blog system you will want to keep the parameters after the domain name. E.g., if someone called http://olddomain.com/lang/en-us/living-with-complexity you would want to forward it to http://newddomain.com/lang/en-us/living-with-complexity. For this purpose, I found the following .htaccess snippet handy:

Categories
apache django opensuse python

Django Invalid command ‘SetEnv’ in OpenSUSE

Today I came upon a problem when I wanted to integrate a Django project into my Apache via mod_python on my OpenSUSE virtual server.

I put the snippet I need for Django into a separate config file called django.conf into the folder /etc/apache2/conf.d/ from which all files are automatically loaded whenever Apache starts.

Everytime I wanted to start my Apache it said
Syntax error on line 6 of /etc/apache2/conf.d/django.conf:
Invalid command 'SetEnv', perhaps misspelled or defined by a module not included in the server configuration

This seems to be a problem with the Apache configuration of OpenSUSE as mod_env which provides the SetEnv directive is installed but disabled.

Solution:

  1. Start yast (from the command line)
  2. Select “Network Services”
  3. Select “HTTP Server”
  4. Select “Server Modules”
  5. Select “Network Services”
  6. Scroll to “env”
  7. Select “Toggle Status”
  8. Select “Finish”

Done.

Categories
apache Plesk Uncategorized

Remove Plesk default host from Apache conf in opensuse

Yesterday, I struggled with a problem on my virtual server that Plesk automatically sets /srv/www/vhosts/default/htdocs as the htdocs directory of the Apache.

Anyway, the greatest advantage of the Apache configuration of opensuse is its biggest problem: everything is set up very modularly. There are many things you can edit and install with yast and there are many that you can not. The point is that you will have to decide at one point if you tweak a setting manually and give up searching on Google for the appropriate solution with yast or some rpm manager or whatever the best solution should be.

Then you will haveto start searching in the VERY modularly set up apache config directory /etc/apache2/.

I could solve my problem by deleting the file /etc/apache2/conf.d/zz010_psa_httpd.conf. Files from this directory are included automatically in the file /etc/apache2/default-server.conf into the Apache configuration by the directive
Include /etc/apache2/conf.d/*.conf

/etc/apache2/default-server.conf itself is included into the main config file httpd.conf of Apache by the directive
Include /etc/apache2/default-server.conf

Phew…