full of … these

Rewrite rule without losing the initial URI

Posted: November 9th, 2012 | Author: | Filed under: howto, idiots | Tags: , , | No Comments »

Today, I had to add a rewrite rule to keep the short word (keyword) after “domain.com/”.

So, you want to keep the keyword in the address bar, but load the long URI and not showing it.

Here is my solution:

RewriteRule ^/(keyword-or-short-name)/?$ /long/i-mean-long-very-long-with-lots-of-params.htm

Happy users!


Trac 0.11 – Fix Clearsilver dependency

Posted: November 20th, 2009 | Author: | Filed under: howto, idiots, linux | Tags: , , , | No Comments »

If you get the following message:

You're using a plugin which requires the Clearsilver template engine
and Clearsilver is not installed. Either disable that plugin or install Clearsilver.

But, you have compiled and installed latest clearsilver from sources and copied neo_cgi.so to site-packages, and still not working, here is what to you have to do.

For this environment was tested: Linux opensuse 11.1 and centos 5.2, Trac 0.11 with python 2.4 or 2.6, TracDownloader and/or TracWikiToPdfPlugin installed.

Search for clearsilver-*.egg in site-packages and move to another directory.

My clearsilver package name was: clearsilver-0.10.1-py2.6-linux-i686.egg
Restart apache.

Enjoy and say thanks if this solved your problem.

RewriteRules for special characters

Posted: November 18th, 2009 | Author: | Filed under: fun, howto, idiots, linux | Tags: , , , | No Comments »

Let’s say you have to write RewriteRules for special characters (East Asian Languages in this example, but, it should work for any other).

Link that you want to work: http://domain.tls/리눅스
Destination http://domain.tld/linux

First you must convert/encode (I used http://people.w3.org/rishida/scripts/uniview/conversion.php)
리눅스 is converted to %EB%A6%AC%EB%88%85%EC%8A%A4
You can get this from your access.log file of your server if you access it.
Now, you have to escape the % to match the regexp. Replace % with \x:

RewriteEngine On #add it in case it was not added above
ewriteCond %{HTTP_HOST} domain.tld
RewriteRule ^/\xEB\xA6\xAC\xEB\x88\x85\xEC\x8A\xA4$ http://http://domain.tld/linux

Restart or reload.
mod_rewrite should be loaded.
Debug: read /var/log/httpd/error.log and access.log (or corresponding error/access log file for the vhost you want the rule to be added.

Why sometimes RewriteRules don’t work

Posted: November 10th, 2009 | Author: | Filed under: howto, linux | Tags: , | No Comments »

I’m not an expert, but here is what you should check.

When you add a domain to be forwarded to a page on the same domain like this:
RewriteCond %{HTTP_HOST} domain-1.tld
RewriteRule ^/$ http://www.domain-1.tld/link/to/the/page/you/want/to/be/forwarded.htm [L]

And, after this you want another section named “section”of this site to be forwarded elsewhere, the other domain like this:
RewriteCond %{HTTP_HOST} domain-1.tld
RewriteRule ^/section$ http://www.domain-2.tld/link/to/a/section.htm

This will not work.
This will not work even if you want to escape the /section by placing it above the rewriterule for /.
This is happening because of the [L] from the first rewrite.
[L] Tells Apache to not process any more RewriteRules if this one was successful.

Now add [L] for /section and you are good to go.

apache + mod_ssl, 12263 error

Posted: March 13th, 2008 | Author: | Filed under: fun, howto, linux | Tags: , , , , , | 2 Comments »

Recently I wanted to enable https on a opensuse 10.2 server. After generating certificates using easy-rsa from openvpn package, and installing them in apache’s config I got an 12263 error in firefox.

Searching logs didn’t help: only messages about “Invalid method in request \x16\x03\x01“.

Googling for about 30-40 minutes didn’t help but i have found the following link:


where, at the end of the page says:

to check your vhost setup, use "httpd2 -S -DSSL"

Cause: client speaks HTTPS, server speaks HTTP. If that happens to be port 443, it means that the server is listening on the port but not with SSL.

I went in apache’s config from sysconfig (/etc/sysconfig/apache2) and I have added “SSL” like below:


and it worked :).