How to get Joomla installed domain - joomla

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

Related

How to url rewrite for multi-lang Joomla site (add fake sub directory in url)

How to url rewrite for multi-lang Joomla site:
Now is:
Enter:
www.example.com/
Redirect to English site:
www.example.com/en/
====================================================
What I want to do is:
Enter:
www.example.com/hk/en/ (Not redirect to www.example.com/en/hk/en/ which is wrong)
And reading this:
www.example.com/en/
There is a default Joomla plugin called Language Filter which should take care of this.
If you haven't already enabled it, then I would suggest you do via the Plugin Manager in the Joomla Backend and adjust the parameters accordingly to whatever suits you.

how to give the url in joomla supporting form

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..

joomla rename component url using htaccess

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

Single Sign on between Joomla and Wordpress

I have a wordpress instance installed in joomla's root folder, I would like to enable Single Sign On with joomla and wordpress. How do i do that. Also, i tried with attempting to access session value set in joomla page in my wordpress. But an not able to access it.
Appreciate any methods to enable Single Sign on bt/w joomla and wordpress.
Jfusion would probably be the easiest way to handle the dual login.
http://www.jfusion.org/

Get the SEF URLs for articles in Joomla

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.

Resources