Skip to main content

Redirecting index.php to root in Joomla 1.5 wiht htaccess


Its very important that the homepage of the website is accessible through one URL only. For example, a typical joomla site would be accessible by domainname.com, www.domainname.com, domainname.com/index.php and www.domainname.com/index.php. If you are using frontpage component on the homepage, you may have an additional URL for homepage. This way, the power of backlinks and google PR is distributed across several URLs. This can be easily taken care of by using the following code in .htaccess file.


For redirecting /index.php to www.domainname.com:

Options +FollowSymLinks
DirectoryIndex index.php

RewriteEngine On
RewriteBase /
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/
RewriteRule ^index\.php$ http://www.domainname.com/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]


For redirecting domainname.com to www.domainname.com:

Options +FollowSymlinks
RewriteEngine on
rewritecond %{http_host} ^domainname.com [nc]
rewriterule ^(.*)$ http://www.domainname.com/$1 [r=301,nc]



Once you have done this, you can check the redirection using a fantastic redirect check tool I can across. This tool will provide all possible URLs for your homepage along with the response code. The response code of 200 which is an OK response should be returned by just one URL.

Comments

Popular posts from this blog

Blogged: චන්නට මොකද උනේ ? චන්න ඇයි මෙහෙම කරගත්තෙ ?

ඊ.බී. චන්නව මා හඳනාගන්නේ 1994 වසරේදීයි එවකට මම පාසල් ශිෂ්‍යයෙක්, සෑම පාසල් ක්‍රීඩකයෙකුම සිහින මැව්වෙ, චන්න වගේ පාපන්දු ක්‍රීඩකයෙකු වෙන්න.  ඔහු මුලින්ම ජාතික තලයට පිවිසෙන්නේ, වයස 18 න් පහළ ශ්‍රී ලංකා කණ්ඩායම නියෝජනය කරමින් ඉන්දියාවේ පැවැති තරගාවලියකට සහභාගීවෙමින්, ඔහු ගාල්ල යූත් ගාල්ල යුනයිටඩ් ක්‍රීඩා සමාජ දෙකම විටින් විට නියෝජනය කල අතරම, ඔල්ඩ් ජෝස් ( මරදාන ආදි ශාන්ත ජෝසප් ) කණ්ඩායම නියෝජනය කලා. පාසල් සමයේම දක්ෂතා ගොන්නක් එක්ක පීදුනු මෙම ක්‍රීඩකයා ප්‍රධාන පෙලේ තරග වලට පිවිසුනේ   , පෙටා යුනයිටඩ් හා වික්ටර් ක්‍රීඩා සමාජ වලින්.  ජාතික කණ්ඩායම වසර 15 කට අධික කාලයක් නියෝජනය කරපු චන්න මෙරට ඇති බොහෝ ක්‍රීඩා සමාජ වල ප්‍රධාන සාමාජිකයෙක් වුණා. ඒ වගේම මාලදිවයින, ඉන්දියාව, බංග්ලාදේශය වගේ රටවලත් ක්‍රීඩා සමාජ තරගවලට ක්‍රීඩා කරපු චන්න දැන් ඉන්නේ ගාල්ල නගර සභාවෙ සුලු සේවකයෙකු විදියට ලු..  දැනටත් කලුතර බ්ලූස්ටාර් කණ්ඩායමේ සාමාජිකයෙකු වන චන්නට මෙහෙම වුනේ ඇයි ?  ඔහු  අතීතයෙන්, වර්තමානයට හෝ අනාගතයට අයෝජනයක් කර ගෙන නැත. ඉහළ සාමාජ තත්වයක් සකසා ගැනීමේ හැකියාව මෙන්ම අත්දැකීම්...

Best 6 Way to filter your feeds

There are many ways to filter news feeds from your favorite sources, including passively by relying on meme trackers like Techmeme or social news services such as Google Reader's shared items. We've also taken a look in the past at automatic filters such as Feedhub ( our coverage ) which learns from your behavior to suggest posts, or AideRSS ( our coverage and here ), which uses outside metrics to determine which items in an RSS feed are the "best." For the purpose of this post, however, we'll focus on services that let you filter by keyword. Feed Rinse is a best of class RSS filtering application. It offers filtering by keyword, tag, author, title, etc. It supports regular expressions, has a built in profanity filter, and lets you upload your OPML file for easy importing of your RSS feeds (it can also export to OPML). And since we first covered it in April of 2006 it has gone completely free. FilterMyRSS is a no-nonsense keyword fil...

Blogged #Gammadda - සල්ලි එපා වන්දි එපා මාලුයි ඕන...

මේ කතාව මට නුපුරුදුයි...  සල්ලි ඉල්ලන වන්දි ඉල්ලන රජයට බනින මිනිස්සු ඉන්න රටේ මේ වගේ ඉල්ලීමක්... අම්පාර පොතුවිල් වලට ළඟ රොට්ටේ ප්‍රදේශයේ පෞරාණික කොවිලක් අසලට ගිය විට කෙනෙක් ඇවිත්...  සර් පොඩි ප්‍රශ්නයක් තියනව. ඇවිල්ල බලනවද ඇහුව..  ප්‍රශ්න නැත්තෙ කාටද යමුකො බලන්න.. මඩ වතුර පිරුණු වැවක් ළඟ ධීවරයන් පිරිසක් අමුතු කතාවක් කියන්න වුණා... "මේ වැව දැන් හිඳිල, මේ වටේට ලොකුවට කරන කුඹුරු තියනව. මේ ගමේ අයට කුඹුරු අක්කර භාගයක් තියා එදා වේල කන්න සල්ලි නෑ. මේ හැම පවුලම රැකෙන්නෙ වැවෙන් අල්ලන මාලු වලින්. අපිව මාලු අල්ලන මිනිස්සු නිසා ගණන් ගන්නෙත් නෑ" අපි සංගමයක් විදියට එකතුවෙලා වැහි කාලෙ අාපු ගමන් මාලු පැටව් සල්ලිවලට අරන් වැවට දානව. ඒ මාලු ලොකු උණාම අල්ලනව ඒත් ලොකු දැල් දාල. මොකද මාලු පැටව් පරිස්සම් කරගන්න ඕන.  දැන් අවුරුදු දෙකක් තිස්සෙ පෑවිල්ල. ඒ මදිවට තියන වතුර සේරම කුඹුරුවලට ඇරල මාලුන්ට ජීවත්වෙන්න බෑ. වැව හිඳෙද්දි මාලු මැරෙනව. ලුණු ගතිය වැඩි වෙනව. දැන් කොක්කුයි පිට රටෙන් ඇවිල්ල ඉන්න කුරුල්ලොයි ඉතුරු මාලු පැටව් කනව. මේ අවුරුද්දම ඉවරයි. අපේ ගෑණුන්ගෙ කණ...