How to remove bits from the url using the htaccess file? - .htaccess

Hi I am using joomla for my website and I would like to remove the bits in between my url.
The original URL:
"/calums/index.php/component/jsjobs/jsjobs/employer/"
The way I want it to be:
"/calums/employer/"
It would be great if some one can help me work out how to do it using the htaccess file.
Thanks.

first of all you need to enable SEF in Joomla to get rid of the /index.php/ part:
enable sef in global configuration (the first two checkboxes)
copy your htaccess.txt to .htaccess
This is transparent and should make your URL look like this:
/calums/component/jsjobs/jsjobs/employer/
Then, by looking at your URL, it appears the component jsjobs doesn't have a menu item associated. Menu items are associated with views, so you should go into menu manager and add a new menu item and try to setup menu items for jsjobs. You might not find one that matches exactly but you should be partway there.
Once a menu item is setup (and the cache is cleared) you should begin to see
/component/jsjobs replaced at a minimum. If there is no menu item that produces the right url, then you might have to create an .xml file in the component/view folder you desire. More details in this answer: Joomla Developement :: Probleme with URL Rewriting

my first answer on stackoverflow. try this:
RewriteEngine on
RewriteRule ^(\w)/(\w)/(.*) $1/index.php/component/jsjobs/jsjobs/$2/$3

Related

how to remove id of div in url with htaccess

I am having in an url the id of a div (#latest) like this at the end:
http://example.com/discussion/64/moderators-only#latest
http://example.com/discussion/32/bugs#latest
// and so on...
How can i remove the #latest in all these url's with htaccess?
You can't. Anything after the # is a URL fragment that the browser never even sends to the server. So the only thing the webserver sees is: http://example.com/discussion/64/moderators-only. So nothing in the htaccess or even in the apache config can do anything about those fragments.
You'll need to employ some sort of javascript or client-side solution if you want to remove it. But a better question is, do you need this in order to display the content correctly? If so, then how do you expect to display the content if this is gone?

Joomla Search returns invalid weblink URLs (SEO Friendly URL's not working)

When the Global_Configuration/Site/SEO_Options are set to:
Search Engine Friendly URLs: Yes
I come across errors with the weblinks...
If you navigate through the menu items to weblink, it will present you with a working URL:
www.mywebsite.com/links?task=weblink.go&id=101 = Correct
Using the Search utility to find the same weblink will return the following URL:
www.mywebsite.com/component/weblinks/2-other-21591/101-flanchford-bridge-scc-news-page?Itemid=180 = Broken, not working.
If I set:
Search Engine Friendly URLs: No
Both the Search & Navigation through the menu items will return a working URL:
Through Menu item navigation:
www.mywebsite.com/index.php?option=com_weblinks&task=weblink.go&id=101&Itemid=66
Through the Search:
www.mywebsite.com/index.php?option=com_weblinks&view=weblink&id=101:flanchford-bridge-scc-news-page&catid=2:other-21591&Itemid=180
Request:
Please can you help me find a solution so that I can keep SEF URL's turned 'ON', and to have the joomla search function return working links. As I currently get 404 pages when clicking a weblink found on a search result...
Please do not advice me to simply 'why not keep it off then?', because I have 1000's of links setup on the site and would like to keep SEF 'ON'
Thank you for reading this.
Any Comments or Contributions are very welcome.
My guess is that the menu is messed up. (Yes i know you said the menu one works.) Try recreating the menu item.
Otherwise
Maybe you modified/overrided a file in components\com_weblinks\?
Look at last mod date. Maybe have a look at components\com_weblinks\router.php
function ContentParseRoute()

.htaccess correct format for RewriteRule

I have a "JQueried" page using tabs - Tab A, Tab B etc the tabs hide/show content based on a link like this: Tab 1 I am using jQuery Address Plugin v1.4
http://www.asual.com/jquery/address/ to create new page titles and a new URL for each tab. If you do not know the Address Plugin recreates the URL so the link #tab1 creates the URL page.html#tab1 but without a page refresh. It also changes the page title but is there any way to create an RewriteRule so that http://domain/page.html#tab1 can be called by say http://domain/tab1.html (where tab1,tab2 etc. have proper names not tab!)
Have tried but don't seem to get it to work. e.g.
Options +FollowSymlinks
RewriteEngine on
RewriteRule about.html /test.php#tab1 [NC]
suggestions please. Thanks in advance - oh the htaccess will go in the actual root folder
Sorry, I checked \#, it didn't work for me either.
How about redirecting to test.php?hash=tab1, and then:
if (isset($_GET["hash"]))
header ( "Location: test.php#".$_GET["hash"] );
Based on my comment above - I have just found this stackoverflow.com/questions/8606127/mod-rewrite-hash-tags so I guess can't be done –

Joomla - Custom component url rewrite

I have the following component #
?option=com_tmportal&module=user&task=main
I've enabled url rewriting and setup the htaccess file which is all working correctly, how would I create a rewrite rule that allows me to access the component above by simply doing:
/portal/ = ?option=com_tmportal
or
/portal/user = ?option=com_tmportal&module=user
or
/portal/user/main = ?option=com_tmportal&module=user&task=main
Thanks for any help, much appreciated :)
You haven't specified Joomla version so I'm assuming 1.6/7/2.5 in my answer.
Short Answer: If you're using Joomla!'s default .htaccess then all you have to do is create a Joomla! menu to each of your components views with the right alias eg. portal for your default component access ie. ?option=com_tmportal.
This is what the default .htaccess does it passes all of the elements after the base URL to index.php to help select the component and view.
Longer Answer
When you create a component for Joomla! you specify the menu settings for each view using an XML file usual the same name as the view file in it's view/tmpl/ directory.
Typically the url to a specific view & task in a component would look like these:
?option=com_mycomponent
?option=com_mycomponent&view=userdetails
?option=com_mycomponent&view=userdetails&task=main
Joomla!'s framework will automatically use the view & task params to get your components correct controller and view (or sub-view). I'm not sure that it does anything with the module param that you have in your URL's so I'd guess you're trapping and processing that yourself.

url rewrite rule

so my first page is index, then from index i call a page called vetements where i include a get variable called cat wich is the category of wear, then when im on vetements page i call a sub category(here i stay on vetements page(the page redraws itsel with php) the problem is im unable to combine this 2 rules in htaccess
my links should look like:
vetements-Robes-Robes-courte
vetements is the name of the page itself
Robes is category
Robes-courte is sub category
right now this rule works when im on page vetements:
RewriteRule ^vetements-(.*)-(.*-.*) /vetements.php?cat=$1&sous_cat=$2 [L]
but it wont work when i go from index to vetements, to make it work from index to vetements i have to do the following:
RewriteRule ^vetements-(.*)-?(.*-.*)?
but then it wont work in vetements(when i redraw the page to call the sub category)
thanks for your help
maybe try a rewerite like this:
RewriteRule vetements-cat-(.*)-sous_cat-(.*)\.htm$ vetements.php?cat=$1&sous_cat=$
this is what was suggested by http://www.webconfs.com/url-rewrite-tool.php
You might also want to look at other tutorials and examples on creating so-called "search-friendly URLs" since that's essentially what you're trying to accomplish.
Does your index page have vetements-Robes-Robes-courte in the link to vetements page?

Resources