Using the Artio JoomSEF module I changed my URL's so that the human species can understand them. And also Google likes these much more.
It took a while to get things working, but I finally did it. And so I deserved my beer for today.
Let's hit it. Make sure that:
- the .htaccess exists in the root of your Joomla! site
- the 3rd party section rules in .htaccess are uncommented (see below)
- the "RewriteBase" rule matches YOUR Joomla! installation
- Joomla! SEF is "ON" in site "Global configuration" (see below)
- JoomSEF is "ON" in site "JoomSEF configuration"
- Apache hands out enough rights to use the .htaccess file
Edit the .htaccess file
# vi /var/www/r71/.htaccess
Options FollowSymLinks
RewriteEngine On
RewriteBase /
########## Begin – 3rd Party SEF Section
RewriteCond %{REQUEST_URI} ^(/component/option,com) [NC,OR] ##optional – see notes##
RewriteCond %{REQUEST_URI} (/|\.htm|\.php|\.html|/[^.]*)$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) index.php
########## End – 3rd Party SEF Section
# Block out any script trying to set a mosConfig value through the URL
RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]
# Block out any script trying to base64_encode crap to send via URL
RewriteCond %{QUERY_STRING} base64_encode.*\(.*\) [OR]
# Block out any script that includes a <script> tag in URL
RewriteCond %{QUERY_STRING} (\<|%3C).*script.*(\>|%3E) [NC,OR]
# Block out any script trying to set a PHP GLOBALS variable via URL
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
# Block out any script trying to modify a _REQUEST variable via URL
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
# Send all blocked request to homepage with 403 Forbidden error!
RewriteRule ^(.*)$ index.php [F,L]
#
########## End – Rewrite rules to block out some common exploits
Adjust Joomla config file (file found in the root of the website)
#vi configuration.php
$mosConfig_sef = '1';
————-
Edit the Apache config file (if you don't have acces to it: get you own server 😉 )
# vi /etc/httpd/conf/httpd.conf
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
…
# This should be changed to whatever you set DocumentRoot to.
<Directory "/var/www/html">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
Leave a Reply