I made a component and now I want to customize the link for it.
I already wrote the router.php.
The link to the component view (if I use the JRoute function of course) now looks good, except for the first part, which looks like :
http://www.example.com/en/component/componentname/...
don't mind the "en", it's there cause I use JomFish to manage more languages on my site.
I want to transform "/component/componentname/" to "/myString/" for example.
I can't use the menu for this, cause my site displays info from a database, linking this many sites to my menu is impossible.
The only solution I found requires the changing of the Joomla JRoute function (I found only a suggestion, not how it's done :( ).
What about using mod_rewrite to rewrite your url?
Basically you put the rewrite rules into your .htaccess file and Apache will handle the rest.
There is a great guide that teaches you all about it on http://www.htmlist.com/how-to/a-simplemod_rewrite-tutorial/
Related
I am asking if is it possible do the following thing using Joomla
I have 2 different URL, something like: www.stupidname.com and www.seriousname.com
If the user open stupidname.com by his browser will open the website having a stupid template
If the user open seriusname.com by his browser will open the website having a serious template
The website and the content are the same...should only change the template according to the url open in the browser
Do you have some ideas about how to do this thing?
Thanks
Andrea
I've done this before making elements of a template conditional based on the domain name, and that can work well. I suppose you could extend the same logic to change the template.
Perhaps you could add a conditional to both template's index.php to change the template. Perhaps something like...
if ( substr_count( $_SERVER['HTTP_HOST'], "silly") ) {
$GLOBALS["mainframe"]->setTemplate = "silly_template_name";
} else {
$GLOBALS["mainframe"]->setTemplate = "serious_template_name";
}
...I've not tested this, but I think in principle it should work fine, though it might depend on which Joomla version you have.
There are, as saji89 pointed out, plenty of good multi-site extensions and that'd be an ok solution too.
From my personal experience with Joomla I can advise you to use the component Virtual Domains (http://extensions.joomla.org/extensions/core-enhancements/multiple-sites/7557) you can add the domains which you redirect to the main site where Joomla is installed and it this component you assign them the template you want.
I can confirm the functionality on Joomla 2.5 latest update with usage of around 5+ different Virtual Domains on one Joomla installation.
Some possible downsides i want to mention:
SEO links can get sometimes messy, you need to play with some SEO component and its settings
its better to use same structure and components for boths side its easier because otherwise the administration gets messy but its possible
the user which register on one website has automatically account on all of them because its one Joomla
Here is my simple php page in which i have links to the Joomla article, but all links are broken, it returns "file not found". I understand, that these external links don't work because they indicate internal pages of Joomla(1.5). How should I configure them so they will start to work?
p.s.: please, forgive me for my terrible English.
You have to set the settings of the page to public. you can do it by using joomla options.
then get the URI try with that. Should work.
edit : also you might have to define the access levels. Follow this link as guide.
Recently I've been looking into Opencart as a solution for simple E-commerce websites. I like it a lot, but I can't seem to get the redirection right.
I am using lighttpd as a web server, and I've noticed that Opencart offers Apache .htaccess configuration for SEO URL's, but no luck for lighttpd.
Opencart uses URLs that are formed like this:
Login Page: http://[domain]/index.php?route=account/login
Product Page: http://[domain]/index.php?route=product/product&product_id=51
Ideally, I would like to have something like this:
Login Page: http://[domain]/index.php/account/login
Product Page: http://[domain]/index.php/product/51/[product-name]
Of course, any pointers in the right direction are highly appreciated. Even a short explanation of where to find the right way to handle rewrites in Lighty would be helpful!
Thanks in advance.
A lot of people have had issues with 1 4 19-5lenny and earlier apparently. If you want to rewrite urls the way you have above, you will need to parse them yourself using your own custom hook (see the preAction in the index.php for handling them by default). Note that you will also need to manually edit urls like the account one since they aren't even sent through the url rewriter before being output
I have a perfectly good (so far) setup of wordpress of for a new website. The pretty urls are working as expected.
I have 1 dynamic page that loads content depending on the querystring:
/dynamic/?loc=england&code=uk
I wish to make this URL "pretty" as well but every-time I modify the .htaccess no changes are made. Tried everything and googled everything else - last resort. If I could get the following to work then I would be happy.
I need to make the URL look like.
/dynamic/location/england/code/uk/
Adding this to any .htaccess breaks the whole website.
RewriteRule /dynamic/(.*)/(.*)/(.*)/(.*)/$ /dynamic?$1=$2&$3=$4
What am i missing.
Thanks in advance
N
Don't add the rewrite rule to your .htaccess file. WordPress manages that file for you, so try to use built-in features whenever you can.
WordPress actually has a somewhat advanced rewrite engine that ships standard - and it's pluggable just like the rest of the platform.
The trick, though, is working with it. You'll need to register your RegEx so WordPress knows what kinds of strings to match (i.e dynamic/location/(.*)/code/(.*) => /dynamic?$loc=$1&code=$2). Then you'll need to set up the page and script on the back end to handle the submission.
For a similar example, look at the answer I received to parsing custom URLs with a custom post type over on WordPress Answers. Extending this, you'll need to set up code similar to the following (note: untested!!!):
<?php
add_action('init', 'add_my_rewrite');
function add_my_rewrite() {
global $wp_rewrite;
$wp_rewrite->add_rule('location/([^/]+)/code/([^/]+)','index.php?loc=$matches[1]&code=$matches[2]','top');
$wp_rewrite->flush_rules(false); // This should really be done in a plugin activation
}
This should add the rewrite structure to your .htaccess file automatically.
I am busy making a Joomla! component. And know i want to link to another component. So, as example i want to link from my component 'my_component' to 'his_component'. Normally this is simple to do. Just make a normal link like href="?option=com_his_component". But the problem is that one of my consumers uses SEO friendly URLs. And in that case this URL won't work.
Does anyone know a way to this the correct way (I think with the Joomla! Api)
Just wrap that link with a call to JRoute::_($url):
$link = JRoute::_('index.php?option=com_his_component&foo=bar');