I am working on SEF - router.php to make my site url user friendly.
This is my url and I want to remove the name 'component' and 'com_test' from this url.
http://localhost/projects/component/com_test/project/1-unique.html
I have checked with unset($query['view']) but it doesn't make any changes on the site.
Note : Please dont got for creating menu item for aliases.
You need menu items for that. otherwise you will get exactly these URLs. There is no way to avoid the /component/com_test/ part as Joomla is not able to guess what you want to do. The part behind that (/project/1-unqiue) is up to the router.php of your component.
If you don't want to have a menu item visible on your site, you can also create hidden menu items just for SEF purposes. You create a new menu with those menu items in it, but don't assign it to a module or just don't show the assigned module on any page.
Related
I am using the external link type menu items within Joomla - the reason is I need to link direct to an anchor on another page from the menu.
I have around 10-15 links, all work as expected except 2.
in my external URL box I have something like this:
"index.php?option=com_content&view=article&id=10&Itemid=207#SystemIntegration"
id - is the article id
Itemid - is the menu item I want to be active
hashtag - is my anchor link
PROBLEM:
On the 2 that are not working it seems to go to url with this "http://www.website.com/component/content/?Itemid=207#SystemIntegration" instead of "http://www.website.com/services/digital-solutions/SystemIntegration#SystemIntegration" as expected
has anyone else had this issue? I have a feeling its connected to the SEF urls being on.
Joomla 3.5.0 version
Step1. Create a Hidden Menu from Joomla admin==>Menus==>Manage==>add
new menu
Step2. Select a Hidden Menu ==> add a new menu item==>Menu Item
Type==>Article==>single article==>your article id==>save
Step3. Site load this url(take copy)
Step4. Create a new menu from external url Pate the previous url
(include #)
Nothing I tried worked reliably - so I got round it by making each item go to the single article, then using a spare field to store the name of anchor. Then within some custom JS code I checked if the field was set and automatically scrolled the page to it if it was - works better than the joomla standard anyway and is more reliable
I need to hide component name in joomla urls.
I have also applied configuration for SEO urls in administrator.
But still it is displaying component name in urls
So please suggest me appropriate solution for hiding component name in urls
You need to create a menu item (or tree of items) to the component. The alias you give the menu will appear in the URL.
Can someone pinpoint me to where alias in com_menus is changed because I need to add to url few values and Joomla is striping & and % etc
i have something like this :
mysite.com/going?3DPA%26tt%3DF%26sd%3D*3%26ed%3D*20%26drf%3D6%26drt%3D15%26a%3D2%26at%3D33554432%26st%3DPA%26sp%3D2
and Joomla is creating this:
mysite.com/going-3dpa-26tt-3df-26sd-3d-3-26ed-3d-20-26drf-3d6-26drt-3d15-26a-3d2-26at-3d33554432-26st-3dpa-26sp-3d2
How do I prevent it from changing anything?
The menu alias is determined by Joomla AND the component's router.php.
My best guess to get you out of this issue is just base64encode your param so Joomla sees it as a single param. Then add it to the view default.xml with a string value, this way Joomla should be able to build the SEF route; just check your router.php and debug it if it's not behaving as expected.
In order to have SEF routing correctly, you will need to create a menu item pointing to the view; if you don't need it, just hide it in a hidden menu.
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');
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.