How to use only one url for a site ---(SEF URLS)

Your code modifications and patches you want to share with others.
Locked
User avatar
arjuninfo
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 113
Joined: Sat Aug 08, 2009 12:50 pm
Location: India ,chennai

How to use only one url for a site ---(SEF URLS)

Post by arjuninfo » Mon Feb 15, 2010 6:47 pm

How to use only one url for a site?

Here is an fix for that ...

IF a user turn on the SEF ,he can use the both SEF and Non Sef URL
------------------------------------------------------------
example

sef url : www.examplesite.com/arjun.html (article id=20)

non sef url : http://www.examplete.com/option=com_con ... Itemid=216

------------------------------------------------------------

when a user types the non sef url,it should not go the article page,it will redirects to index page or 404 page ...

For that u need to add a small code in the top of templates/templatename/index.php

<?php
$url_array = explode("option=com_content&view=article",$_SERVER['REQUEST_URI']);
if(count($url_array) > 1) {
header('Location:index.php');
}
?>
M.Arjun

Locked

Return to “Core Hacks and Patches”