Hot answers tagged

17

You can do that by enabling the SEF URLs and especially the parameter "Use URL rewriting" in the Joomla global configuration. Please note that this will generate an internal server error if you didn't create the .htaccess file before enabling the option. There is a doc page explaining what steps are needed to get those nice URLs. Have a look here: http://...


13

Use JRoute for this: rtrim(JUri::base(), '/') . JRoute::_(ContentHelperRoute::getArticleRoute( $article->id, $article->catid )) but you don't need JUri::base() if you don't want to link to a different domain.


7

To assign modules to pages; Joomla 2.5 instructions Log into the Joomla administrator area of your site Select the Extensions menu and Module manager menu Open the module/menu you have created Scroll down to the bottom of the module position You will now see the menu assignment options where you can assign the module to selected pages or all pages To ...


6

Solutions: One option is to prevent Joomla from creating canonical URL's, by creating an override for the file /plugins/system/sef/sef.php on line 51 (better no canonical then an incorrect one) If it just concerns one or two pages on the whole site, you could consider using NoNumber's ReReplacer plugin to set the correct tag Install a plugin or ...


6

With the core routing system, there isn't a practical way to accomplish it. You can use a tool like sh404SEF to achieve this though.


6

With the below .htaccess rule you can redirect all pages from a url with the pattern of: https://www.portal-gestao.com/whatever/whatever/9999-title-of-the-page to a new url of : https://www.portal-gestao.com/item/9999-title-of-the-page htaccess: RewriteEngine On RewriteCond %{HTTP_HOST} ^www.portal-gestao.com RewriteRule ^.*/.*/(.*)$ https://www....


5

Technically, you can start the website without SEF enabled and can enabled it later. Enabling the core SEF functionality does not involve a lot of extra work. It is only enabling the SEF options in the global configuration and renaming the htaccess.txt file to .htaccess, if you want to enable also URL rewrite to remove the index.php from the urls. There are ...


5

Good question. It looks likely that the new Joomla router held over until Joomla 3.6 will fix this issue. In the meantime, there is a $15 extension, SEF Wizard for Joomla that, "removes IDs from the URL of standard Joomla components, such as com content, com contact and com tags".


4

Changed htaccess.txt to .htaccess Site > Global Configuration : Use URL rewriting (Choose Yes) SEO Settings Search Engine Friendly URLs(Choose Yes)


4

There is a system plugin called System: SEF. When enabled, this plugin scans the final HTML output just before it is sent to the browser, and replaces any non-SEF links with their SEF counterparts by running it through JRoute::_($url);. This only works for internal links though beginning with index.php, so it won't work if the link starts with http://. Try ...


4

There is no easy way to override that. In the end it uses JFilterOutput::stringURLUnicodeSlug() or JFilterOutput::stringURLSafe() (depending on the global setting) to make the alias URL safe. Since & isn't a valid character in an URL it is stripped and replaced with a -. So you had to override a core class, which isn't recommended at all. The easier ...


4

First off, you have duplicate content (which as you have noticed is hurting your rankings), even though it is using the canonical attribute. I Googled your site, and both links lead to the same exact page. Make sure you heave it set up like this in K2 http://www.pixelfire.com.au/images/blog-images/K2-settings.jpg ;) Second, you didn't mention when moving, ...


4

This is to clear any misconception about having a self-referenced Canonical Link Element, as using one is not an issue, and how could it be - to say that the page you are viewing at this url is actually the one you mean to display (??) Google is perfectly fine with this. As far as I know, it only Bing that has a recommendation to avoid using self-...


4

You could add this code to the top of Joomla's index.php: if(strcmp($_SERVER['REQUEST_URI'], '/index.php') == 0 && $_SERVER['QUERY_STRING'] == ''){ header("HTTP/1.1 301 Moved Permanently"); header('Location: /'); exit; } Be careful though, if you take this approach, you'll need to redo this when you upgrade.


4

Instead of $_SERVER['REQUEST_URI'], you can rely on JUri::root() template parameter can not be added concatenating it with &. It has to be ? ... but it depends on the Url query. Thus, you need a piece of code like this to define the glue: $uri = JUri::getInstance($url); $query = $uri->getQuery(); if (empty($query)) { $glue = '?'; } else { $...


4

I managed to piece together a solution without using .htaccess, though I'm interested in a cleaner solution if somebody has one. I created a system plugin that really does nothing in the conventional sense, in that it has no methods except _construct (). In the _construct() method, I simply checked for strings in the URI that were found in the old links ...


3

Firstly, in the Global Configuration, set Use URL rewriting to Yes. This is the option to remove the index.php from the URL. Once done, simply rename your htaccess file to .htaccess, which you appear to have already done. This will allows the first change mentioned above to be performed.


3

You can enable it after the fact, but be very careful when doing so. I would strongly recommend backing up your website before installing any SEF component. POSSIBLE PROBLEMS If not done properly, activating sh404SEF on an already established site can have the opposite effect of what you are trying to achieve. Why? Consider the points below: Your current ...


3

Since this is one of the most common questions around Joomla, I though to share a new extension I came across that deals with it. Plugin: Direct Alias Pro For those people that don't want to mess with the extended capabilities of the majority of SEF extensions, this a much simpler plugin, that one of each features is to remove ids from articles, categories ...


3

If you create a menu item for each of these then the menu item alias is used for the URL instead. The menu you create these links in doesn't have to be published on your site, it's enough that the menu item exists in menu manager. You can create a new menu called 'dummy links', or whatever you like, and create links to your categories and articles there. ...


3

Here is another way of getting the correct root URL of the site. This also takes care if your site is in subfolder $rootURL = rtrim(JURI::base(),'/'); $subpathURL = JURI::base(true); if(!empty($subpathURL) && ($subpathURL != '/')) { $rootURL = substr($rootURL, 0, -1 * strlen($subpathURL)); } Then you can do $url ...


3

You can use Advanced Module Manager. With Advanced Module Manager you have the possibility to assign modules to just about anything you want.


3

JRoute is not reliable on the backend. Your approach may work on a simple install, but if you have a third-party SEF plugin, or even some slightly unorhodox routing in third-party components, this will fail miserably. So I won't answer how to get rid of the 500 error. But propose an alternative solution. In a popular SEF extension, ACEsef if I remember ...


3

Here is how I ended up getting it to work: $live_site = substr(JURI::root(), 0, -1); $app = JApplication::getInstance('site'); $router = &$app->getRouter(); $url = $router->build($live_site.'/index.php?option=com_icagenda&view=list&layout=event&id=' . $id . '&Itemid=' . $Itemid); $url= $url->toString(); $eventLink= ...


3

The solution is quite simple: Instead of using the alias, create a link with the menu item ID: <a href="index.php?Itemid=XX">Contact us</a> where XX is the ID of your menu item. The ID can be found in the menu item manager: The link will automatically be converted to the correct URL, regardless of the menu item alias, location etc.


3

The best practice to avoid any unpredictable urls is to create "Articles - Category List" or "Articles - Category Blog" menu items for all your top level article categories. This way all your articles will inherit the url structure from these menu aliases. Go to Menus->Add New Menu Create a Menus say "Articles" Go to that Menus Add the menu item for each ...


3

What you could do is use Joomla's Redirect Manager to redirect the old URL to the new one. In the Joomla backend, go to: Components >> Redirect >> New In the Source URL field, enter the old URL and in the Destination URL field, enter the new URL


3

You can use JOOMSEF component, which is for SEO purpose and more of this extension is free. Also in that component you have option to remove category and menu names from url and also you can customize the url according to you.


3

In the old days, the router.php file contained functions: BuildRoute and ParseRoute. Nowadays, if you look at the router.php of the banners extension for example, you will see a class called BannersRouter which extends from JComponentRouterBase, and within that class you will see the build and the parse functions. Additionally, just immediately after the ...


2

Here is a general method if your site crashes using .htaccess: You should comment one or both of these lines: Options +FollowSymLinks and/or, RewriteBase / This should work fine! Note: you do commenting by giving a hashtag for a line "#"


Only top voted, non community-wiki answers of a minimum length are eligible