URL rewriting in joomla - joomla

I need to rewrite url in joomla. But the url should not be showing "index.php" and no numbers (0-9) as well.
1st condition:
The url cannot be " http://www.abc.com/index.php/components/article" rather than it should be "http://www.abc.com/components/article".
2nd condition:
the url cannot be "http://www.abc.com/components/article/9" where it contains 9 number .
How can this be done?

Joomla comes with htaccess.txt, and the option to rewrite urls. So you have to first change the htaccess.txt file to .htaccess on the server, then login and in the configuration settings change SEF to on, and use .htaccess to on.

In support of the answers from gnomeontherun and Hennie. You have some control over how the url is made up by joomla, through the menu structure and the alias for the each menu.
Sometimes it's worth creating menu items even if you don't show them on a menu on your site.
e.g.
Menu structure:
Home
-Latest News *(Could be a category blog view)*
--News article 1 *(Link to article but this level need not be shown on menu)*
--News article 2 *(Link to article but this level need not be shown on menu)*
url should look like:
/latest-news *(for the blog view)*
/latest-news/news-article-1 *(for the article view)*
If there is no menu item which relates to an article, Joomla makes up the url itself using category+id/article-alias+id etc. If it does find a menu item, it will use the structure of the menu instead.
Joomla uses the alias of the menus for the actual content:
i.e. menu-alias-level1/menu-alias-level2/news-article-1
Using this method from the beginning will allow you to keep your urls consistent whether they are accessed through the blog page route or directly. This will help with your SEO.
Of course it can be a pain to create a menu item for every article but I know some Joomla guys who swear by it and will do it even for thousands of pages...

for the index part ...
Perhaps this will work for you too
RewriteRule ^index\.php$ http://www.yourdomain.com/ [R=301,L]
or
Redirect 301 /index.php http://www.yourdomain.com

To get rid of the 'index.php':
Rename the htaccess.txt file to .htaccess
In the backend, turn on SEF URLs and URL rewrite
Joomla will then show your article using something like "http://www.example.com/category/article/9", unless you assign a menu item to that article. There is no need to show that menu, so you can create new menu, call it 'hidden' (or any other valid name) and do not publish the module.
A more comfortable option is to use one of the many SEF components, which make it much easier to manage the URLs. Most if them additionally provide meta data control.

Related

Joomla 3 - Generate URL based on article alias without creating menu item

Description:
I have almost 4,000 articles and now i want the SEF URLs for them all based on alias of each article is it possible if i can achieve this without creating menu items?
i.e (www.websitename.com/article-alis)
Problem:
I know i can achieve this if i create menu items for them all but i don't want to create 4,000 menu items and want some quick and easy way but based on article alias so i can change it whenever i want.
Thanks, Aamir
UPDATE
If you want make that, you must do rename htaccess.txt (for activate SEO Control) and modify your .htaccess (on main folder site) and peraps create your propers rules.
First : Have you renmae the htaccess.txt file (on main folder site) to .htaccess?
is here where contain all rules for rewriting!
Example: RewriteRule ^folder1.*$ http://example.com/folder2/ [R=301,L]
On this example, all article start on folder name folde1is rewrite by folder2
You can see more : https://mediatemple.net/community/products/dv/204643270/using-htaccess-rewrite-rules
or for Joomla 3 rewriting : https://docs.joomla.org/Enabling_Search_Engine_Friendly_%28SEF%29_URLs

Joomla - Use index.php instead of "/" as homepage

Let:
test.tld = domain
test.tld/index.php = my Joomla home page
test.tld/ = a pre-release page (index.html) that isn't Joomla
Now Joomla always wants to go to test.tld/ as homepage so I basically get lost (because it isn't Joomla)
How to set Joomla so that the Menu to homepage is "test.tld/index.php" not assume I want "test.tld/" ?
I already tried making a dummy homepage on an invisible menu so that the "home" on the navigation isn't really a "home"
Is there no better way? Thanks
You can solve this issue in two ways:
Recommended: Your web-server default index is set to index.html file. You can change that based on your web-server (Apache, Nginx, whatever).
NOT Recommended: You can disable Rewrite URLs feature in Global Configuration of your site, this will show index.php on every page.

Why is Joomla 1.5 creating different URLs for the same articles on different pages?

I'm trying to understand the way Joomla (1.5) creates article URLs.
I created a module to display news. The module displays all the news, with correct URLs on the homepage mysite/component/content/article/xxxxxxxx.
I created a module to display the last article on the homepage and a button, see all news, linking to a menu item displaying a page with all the articles. The url is: mysite/news.
The problem is the URLs to the article are generated incorrectly as mysite/news/xxxxxxxx and they give a 404. How can I get the URLs to be the same as on the homepage?
Update: The new URL doesn't give a 404, it points to the same page as the menu, I mean mysite/news/ is the same as mysite/news/xxxxxxxx, it shows the list of all the articles and not the article itself
To create proper SEF URLs, two steps are needed:
Be sure to have a menu entry for each article in the list. You don't have to display that menu, it just has to exist. The menu entry's alias is used to build the SEF URL.
When creating links to such an article, be sure to include the parameter Itemid=n in the URL, with n being the id of the menu item. In article texts, use this structure:
index.php?option=com_content&view=article&id=23&Itemid=125
Joomla! will convert that into a SEF URL automatically, and it will still work, when you for some reason turn SEF off.
If you generate links in a module, the URL is not converted automatically. You have to call JRoute::_() for that:
echo JRoute::_('index.php?option=com_content&view=article&id=23&Itemid=125');

Joomla .htm url mapping to pages in CMS

I inherited a Joomla site that has a set up I'm not familiar with. The url of pages on the site are like
http://hufboxing.com/about.htm
http://hufboxing.com/training.htm
http://hufboxing.com/schedule.htm
I looked in the .htaccess file and do not see any rules that map .htm urls to the Joomla query string urls.
In the CMs, on each article are url alias. The corresponding URL alias to each of the urls above are:
http://hufboxing.com/about-us
http://hufboxing.com/team-training
http://hufboxing.com/the-gym-schedule
However, going to any of these alias gives a 404 page. Even if I attach a .htm extension to these urls, it gives 404 page.
Where do I go in Joomla to add new pages to the site and add new .htm urls?
Here is the website:
http://www.hufboxing.com
That is normal. They are based on your article and menu aliases. Joomla uses a database to store the text so you won't find pages. How do you want the urls to look? Also what version? To add pages login to administrator and go to create article. Then you may want to go to the menu manager and link. I recommend you review the beginner docs at http://docs.joomla.org.

Custom short URLs in Joomla 1.5

I had a long ugly long URLs for Joomla articles. Being advised here to enable SEF, I got:
www.domain.com/cat1/subcat1/120-results-of-DES-project-in-2011
Nicer, but I also want custom short URL for specified article, like:
www.domain.com/des
Is this possible in Joomla 1.5? Simply adding rule to .htaccess is possible but not what I'd like, because:
I'd prefer that the short URL remains in the Location bar after the page is loaded
Joomla to use that short URL whenever the articles is clicked from news etc.
(P.S.: if it's not possible, then I'd be happy with some simple URL "aliaser" for Joomla, which would work similarly to .htaccess, but preferably with short URL remaining in the browsers' location bar.)
As Trev mentioned you need to turn on SEF URLs. In the admin, in the Site menu click on Global Configuration. In the Site configuration you should see a box for SEO settings. Turn on all 3 options unless you don't want the .html suffix, that one can be left off.
Now Joomla will create URLs like this -
www.yourdomain.com/parent-menu-alias/child-menu-alias/article-alias.html
If the menu item is linking directly to an article, then it would be -
www.yourdomain.com/menu-alias.html
Have you enabled SEF and htaccess in the Global Configuration? If you do then the URLs to any articles is controlled by the article's alias. e.g. if you want an article to be
http://mysite.com/my-url just open the article in the article manager and change the Alias field to my-url

Resources