Apache Rewrite Rules
Posted: 06 Mar 2012, 11:14
Fellow coders,
I was asked about the Rewrite Rules so here's some information about it. Note: it's a fairly advanced ManiaLib topic.
First you have to activate Rewrite Rules in ManiaLib config
If you use INI config file:
If you use app.php config file:
Then you have to enable Rewrite Rules on you webserver.
Basically you need to redirect everything in the path info after index.php. Here are the rewrite rules for Apache:
Let's break it up:
=> Activates module
=> Default path after domain name
=> Don't redirect for existing files
=> Don't redirect for existing folders
=> Don't redirect for /media folder
=> Redirect everything else to index.php/....
Hope it helps
I was asked about the Rewrite Rules so here's some information about it. Note: it's a fairly advanced ManiaLib topic.
First you have to activate Rewrite Rules in ManiaLib config
If you use INI config file:
Code: Select all
application.useRewriteRules = true
Code: Select all
$application->useRewriteRules = true;
Basically you need to redirect everything in the path info after index.php. Here are the rewrite rules for Apache:
Code: Select all
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/media
RewriteRule ^(.+)$ index.php/$1 [L,QSA]
Code: Select all
RewriteEngine On
Code: Select all
RewriteBase /
Code: Select all
RewriteCond %{REQUEST_FILENAME} !-f
=> Don't redirect for existing files
Code: Select all
RewriteCond %{REQUEST_FILENAME} !-d
=> Don't redirect for existing folders
Code: Select all
RewriteCond %{REQUEST_URI} !^/media
=> Don't redirect for /media folder
Code: Select all
RewriteRule ^(.+)$ index.php/$1 [L,QSA]
=> Redirect everything else to index.php/....
Hope it helps