joomla installation

Topics: User Forum
Dec 30, 2010 at 1:29 AM


please see this link

i am using joomla version 1.5

in joomla configuration.php i have the following which gives the above result

    var $sef = '1';
    var $sef_rewrite = '0';
    var $sef_suffix = '1';

Note that in the urls above i have index.php in the middle of every link which i need to get removed so that the urls would read as rewrite to rewrite to

also pl note that if i type then there is no such page found -- what i need is that only the url to be modified while displaying on the browser

if this is possible can somebody help please by providing me the details to be put in the iiri.ini file

i have manually installed iirf and it works fine.


thanks very much


Jan 3, 2011 at 4:40 PM

Hi Rajesh

In the parlance of URL rewriting, you would say that you want to rewrite /about.html to /index.php/about.html .  (You have the sense reversed).

The incoming URL request is what you want to rewrite FROM.  The server-side URL that is activated is what you rewrite TO.  You want users visiting the site to tickly /about.html, which is the FROM URL.      You want to serve /index.php/about.html, which is the TO URL.   You also want other .html URLs to be rewritten, similarly.   Such as /recipes.html, and I suppose, other ones.

In the most basic case, doing this with IIRF is very simple. 

RewriteRule ^/(.+)\.html   /index.php/$1.html  [L]


There are some further considerations, some exceptional cases. For the first exception, suppose someone either directly or indirectly visits a URL like /index.php/about.html. The rule above would rewrite that incoming URL to /index.php/index.php/about.html. That is probably not what you want. Consider a second exception: suppose there really IS an HTML file that corresponds to what is requested. In other words, suppose someone requests /Addresses.html and a file by that name really exists. I suppose you would want to serve that file directly. to handle these exceptions, you need to modify that basic rule. 

By adding a negative lookahead into the regex, you cover the first exception.

RewriteRule ^/(?!index\.php)(.+)\.html   /index.php/$1.html  [L]

The above says, for any incoming URL that ends in .html, and does not start with index.php, rewrite. Now, to handle the second case, you must add a condition that checks for file existence. This can be done with the -f flag on a RewriteCond. The result is:

RewriteCond %{REQUEST_FILENAME}     !-f 
RewriteRule ^/(?!index\.php)(.+)\.html   /index.php/$1.html  [L]

The above rule applies only if the ${REQUEST_FILENAME} does not exist as a real file in the filesystem.

Just for completeness, you could factor out the negative lookahead into a separate RewriteCond, like this:

RewriteCond %{REQUEST_FILENAME}     !-f
RewriteCond %{URL}                  !/index\.php
RewriteRule ^/(.+)\.html            /index.php/$1.html  [L]

I suppose that you will also want to handle other filetypes, such as .css, .js. .gif, .png, and so on. I will let you figure that out yourself.