bloginfo('name');

bloginfo('description');

mod_rewrite and .htaccess: advanced tricks

Januar 20th, 2009 by Blu:RayNe

It’s actually called mod_rewrite and not .htaccess! If you want to do rewrite rules have, do yopurself a favor and have first a look at the Apache documentation:
http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html#rewritecond

Look inside varaible/what apache gets:

RewriteCond %{REQUEST_URI} !inside
RewriteRule ^(.+)$ %{THE_REQUEST} [C]
RewriteRule ^(.+)$ /inside:$1/ [R,QSA]

…or …

RewriteCond %{REQUEST_URI} !SEE
RewriteCond %{THE_REQUEST} ^(.+)
RewriteRule ^(.+)$ /SEE:%1/ [R,QSA]

Replace THE_REQUEST with one of the variables presented here.

user1234.mystuff.de -› www.mystuff.de/account.php?user=user1234

RewriteCond %{http_host} !^www\.example\.com
RewriteCond %{http_host} ^(www\.)?(.+)\.example\.com
RewriteRule ^([0-9]+}/$ /account.php?user=%2&message=$1 [L]

Rewriting the fragment part of an URI or anker

Anyway, there is no way that you can user the fragmet part of the URI to rewrite your URL. It is internally stripped away by Apache. It’s not in REQUEST_URI nor in THE_REQUEST. You cannot use PHP nor Perl for that!

See also: http://www.tedpavlic.com/post_apache_rewriting_examples.php

UPDATE: Ah.. yeah… better look into the documentation again ;9 This could save you much time:

RewriteLog "/var/log/apache/rewrite.log"

Filed under Allgemein having No Comments »

No Responses

  1. Pharme28 says:

    Very nice site! cheap viagra

Leave a Comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.