Browsed by
Tag: rewrite

Apache2 Rewritemap

Apache2 Rewritemap

I love apache mod_rewrite. I often fight with it, but if you really want it you can do whatever you want. This time I wanted to find a way to call a file named after the called subdomain. I have a website called www.yellow-sub.net, and there is some subdomains like the-beatles.yellow-sub.net, john-lennon.yellow-sub.net and so on for each part of the website (That’s a SEO consideration in the beginning). I have only one virtual host for that website because I find…

Read More Read More

Apache2 mod_rewrite and %{REQUEST_FILENAME}

Apache2 mod_rewrite and %{REQUEST_FILENAME}

I’m trying to develop a new website to increase my php object oriented skills. For this new website, I want every request for any url that doesn’t match a actual file on the disk to be redirected to index.php (to handle parameters in fact). Easy with apache2 rewrite rules : [cc lang=”apache”] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-l RewriteRule ^/(.*)$ /index.php?rt=$1 [L,QSA] [/cc] This means : if the requested file is not a real file, and isn’t…

Read More Read More

quis, Aenean leo. mattis sit risus