I had created a component 'com_listings' in which users can add their flats.
Presently the url is (working perfectly fine):
http://example.com/index.php?option=com_listings&view=space&layout=details&id=32
Added Rule to .htaccess
RewriteRule ^listings/([0-9]+)$ index.php?option=com_listings&view=space&layout=details&id=$1 [NC,L]
New Clean Url
http://example.com/listings/14
In new Url all the modules are shown, which are displayed on home page, Please guide me where I am doing wrong.
Thanks.
You don't use .htaccess
in Joomla to create SEF URLs, the default .htaccess
already sets up things for Joomla to be able to route requests to the right component, your extra rule is probably breaking that.
Joomla components have a router.php
file that is called to generate the SEF URL, you can read about it on the Joomla Doc's website.
When you generate a link in your PHP you pass the raw URL (your first URL for example) through JRoute::_()
.
e.g.
$url = JRoute::_('index.php?option=com_listings&view=space&layout=details&id=32');
This will put SEF style URL into $url