I’m new to joomla and I’m using joomla 2.5. I need to redirect the page in joomla to another page. I saw that JROUTE is used for giving urls in joomla. but it start only from joomla folder. I need to get a file in the path
http://localhost/joomla/images/uploads/file.pdf
how can I write the above URL in joomla standard format?? can I use JURI base with jroute ??
Try this,
echo JURI::root().'images/uploads/file.pdf'
JURI::root() will return the site url.
If you required physical path try JPATH_SITE
Hope it helps..
Related
I am doing a website in joomla 3.0, I have select a friendly URi in the backend.
I create several componente for the website too, and my route to access to this component is like this.
<?php $link =JRoute::_('index.php?option=com_projects&view=proyectos&format=raw&task=proyecto&id='. $item->id);?>
But when the browser show this router it isn´t friendly router.
Any idea?
You need to create a router.php file for your component to tell joomla how to build the sef url and then parse it when the sef url is requested.
Check out the components/weblinks/router.php file for an example.
Alternatively, if you are using a sef component like joomsef or sh404sef, you will need to create a plugin for your component. You can find documentation on how to do this on the component makers websites.
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.
I need to do custom redirect after login, but i'm not very familiar with the base of Joomla, so i'm did a little hardcode
$app->redirect(JRoute::_('http://'.$_SERVER['HTTP_HOST'].substr($_SERVER['REQUEST_URI'], 0, strrpos($_SERVER['REQUEST_URI'], '/')).'/index.php?option=com_myapp'));
But in some cases there are problems, so is it possible somehow determinate what is the default joomla domain/url/path where it is installed so i could use something like $domain.'/index.php?option=com_myapp'?
P.S.
Using 2.5
You can get the joomla site url using-
JURI::base();
JURI::root();
JURI::base() Result differs according to front and backend
You can check different joomla constant here-
http://docs.joomla.org/Constants
This answer may also be helpful-
Change Redirect URL of Joomla Login Page
I'm building an eshop using Joomla 2.5 and a commercial component for a guy who wants to have multiple vendros and I'm stuck on how to change the component's url.
What I want to change is the url that is displayed when the users passes from a link with his mouse.
For instance, the component has a SEF function which rewrites urls and makes them like that:
http://www.site.com/componentname/products/productname-productid-productcategoryid-vendorid.html
http://www.site.com/componentname/catalog/categoryname-categoryid-numberofpage.html
and what I want is to make it:
http://www.site.com/shop/products/productname-productid-productcategoryid-vendorid.html
http://www.site.com/shop/catalog/categoryname-categoryid-numberofpage.html
So when a user passes over a link it will show him the new url. Is this possible with .htaccess and rewrite rules or this can only be done through the component only? I'm asking this as the component is encoded with ioncube so I can't do it myself.
Thanks in advance!
While you can use .htaccess to rewrite any URL it won't work with Joomla! as the SEF URL is created by JRoute which uses a combination of the core route function and the route.php for the component.
The URL segments are used to find the right component to handle the request, so to change the way the URL is built you would have to modify the route.php of the component (and obviously other parts as well).
For more information on how SEF support works, read this on docs.joomla.org
I use 'No Editor' in Joomla with SEF URLs enabled. With no SEF enabled it's easy to know the URL by just getting the ID of the article. Something like:
Article 1 would be:
http://www.abc.com/j15/index.php?option=com_content&view=article&id=1&Itemid=1
Now if I have SEF switched on, I would get URLs that look like:
http://www.abc.com/j15/the-content.html
Is there a way inside Joomla where I can find out what the SEF URL for a particular page is?
Currently I add these articles to a menu, then from the front-end I get the SEF URL and then use it. I know the process is a little dumb, but I want to find out if there is a better way inside Joomla where you can get the SEF URL (using 'No Editor').
Upload a component, sh404sef or ARTIOsef, to the administrator panel. Here you can manage SEF URLs as well as the old URL and what new name you want to give it.