Hiding sub directory from a url string
-
I have been trying for a few hours now to hide a sub-directory from a url string on a joomla site using .htaccess
every method i have found either has no effect or breaks the site.
i am aiming to change all links with component in them:
http://mysite.com/component/music/7335
to
I am using the latest Joomla 2.5 install but not sure how or if that affects anything.
Any help would be greatly appreciated
-
i'm afraid in my situation the fix tgr0ss offers just gives me a 500 error.
-
I think URL rewriting is the answer.
You don't want the exact example tgr0ss gave, but you should be able to use it to produce URLs that point to, yet hide the /component/ directory.
-
thnks tgr0ss but i am not attempting to point my main url to a sub-directory. i have already seen the above method and it is not a solution for my problem. i have over 100 thousand links with the url string component/music/etc in it and would simply like to hide the word component.
-
This is taken from: http://www.digitalbuz.com/2009/10/21/hide-joomla-subdirectory-in-url/
If you have a website in a sub directory and want to point your main URL to it, here's a trick that worked for us.
We had a Joomla site installed in a sub-directory called "home". This was sitting next to another directory called "dev". The idea was to have 2 copies of the same website sitting next to each other: a "development" site for testing, and a "live" production site.
Scanning the web, we found many people offered the following solution, which involves creating a file called ".htaccess" with the following code:
RewriteBase / # Add trailing slash if path does not contain a period or end with a slash RewriteCond %{REQUEST_URI} !(\.|/$) RewriteRule (.*) http://www.yoursite.com/$1/ [R=301,L] #Change http://yoursite.com to http://www.yoursite.com (Optional) RewriteCond %{HTTP_HOST} ^yoursite.com$ RewriteRule ^/?(.*)$ http://www.yoursite.com/$1 [R=301,L] #Rewrites http://www.yoursite.com/subdir to http://www.yoursite.com/ RewriteCond %{REQUEST_URI} !^/subdir RewriteRule ^(.*)$ subdir/$1 [L]
hopefully that gives you what you need
Got a burning SEO question?
Subscribe to Moz Pro to gain full access to Q&A, answer questions, and ask your own.
Browse Questions
Explore more categories
-
Moz Tools
Chat with the community about the Moz tools.
-
SEO Tactics
Discuss the SEO process with fellow marketers
-
Community
Discuss industry events, jobs, and news!
-
Digital Marketing
Chat about tactics outside of SEO
-
Research & Trends
Dive into research and trends in the search industry.
-
Support
Connect on product support and feature requests.
Related Questions
-
Should we change our URLs for SEO benefit?
Hi, I'm currently covering a maternity marketing role at i-escape and one our main objectives is to increase organic traffic to the website. i-escape has a selection of hand-picked boutique hotels, villas, lodges, guesthouses and apartments for people to discover and book. At the moment each hotel page URL follows this structure: https://www.i-escape.com/hotelname We'd like to change this to include some searchable words in the URL dependent on the type of hotel. For example: https://www.i-escape.com/boutique-hotels/hotelname or https://www.i-escape.com/boutique-apartments/hotelname If we do go ahead, we know we need to make sure all old style URLs canonically redirect to the new style. Is having the keyword in the URL important enough for us to change over 1500 URLs on the website? We have quite a high quality links pointing to these hotel pages URLs. Also, will this help us with navigation/user journeys/crawls as there will be a /boutique-hotels/hotelname rather than just /hotelname? Thanks so much all! Clair
Technical SEO | | iescape0 -
Why put rel=canonical to the same url ?
Hi all. I've heard that it's good to put the link rel canonical in your header even when there is no other important or prefered version of that url. If you take a look at moz.com and see the code, you'll see that they put the <link rel="<a class="attribute-value">canonical</a>" href="http://moz.com" /> ... pointing at the same url ! But if you go to http://moz.com/products/pricing for example, they have no canonical there ! WHY ? Thanks in advance !
Technical SEO | | Tintanus0 -
My whole directory dropped from google
Hi there I have lost a whole directory in Google rankings and this is where my traffic was coming from. Do you know why this would happen? It is the eCommerce part of the site. So if I do site:www.domain.com the site is there and then site:www.domain.com/directory is not there any more. Thanks for your help.
Technical SEO | | vcasebourne0 -
Order of keyword usage in URL
Hi, I have been wondering for a few weeks if the order of keyword usage for a long tail keyword made a difference. Today I ran an on-page report here for a new page which is a review of a product. The report warned about the keyword usage in URL which made me question my knowledge about this. let's say the page is titled Razer Mouse Review my URL is www.example.com/review/razer-mouse I thought it was a bad idea to repeat the same word in a URL, that's why I categorized all my reviews under review directory and avoided using the word "review" more than once. Should I modify this url and make it www.example.com/review/razer-mouse-review Note: I see the report listed this under "moderate importance factors" and still gave the page A grade. any ideas appreciated!
Technical SEO | | Gamer070 -
Redirect everything from a certain url
I have a new domain (www.newdomain.com) and and an old domain (www.olddomain.com). Currently both domains are pointing (via dns nameserves) at the new site. I want to 301 everything that comes from the www.oldsite.com to www.newsite.com. I've used this htaccess code RewriteEngine On RewriteCond %{HTTP_HOST} !^www.newsite.com$
Technical SEO | | EclipseLegal
RewriteRule (.*) http://www.newsite.com/$1 [R=301,L] Which works fine and redirects if someone visits www.olddomain.com but I want it to cover everything from the old domain such as www.olddomain.com/archives/article1/ etc. So if any subpages etc are visited from the old domain its redirected to the new domain. Could someone point me in the right direction? Thanks0 -
Automatic redirect to external urls
Hi all, I'm developing a dynamic qr code service.. The service works in the following way: You create an account with an associated QR CODE pointing to a url like:
Technical SEO | | raulo79
- http://domain.me/username The user can change the target of this url.. he can:
- point to an external url ( his website for example)
- point to a vCard download page
- a mobile ready webpage ( no redirection in this case)... Visiting http://domain.me/username my company logo is displayed and we redirect the visitor with a: header("Refresh: 5;URL=http://userdomain.tld"); Google is indexing many user's URLs, this is good for those users pointing to the mobile ready webpage, in this case there is no redirection, but Google is indexing many urls that redirect to an external url and I don't know how to avoid this.. I can't do an header('Location: http://www.example.com/'); because I need to display our logo after redirection.. how can I do google friendly? Sorry for my english, I hope you can undestand the problem. Best regards.
Mauro.0 -
Importance of SEO Friendly URLs
Hey SEOZ! How important do you all think SEO friendly URLs are to SEO. Here is an example: Non: http://www.domain.com/cart.php?m=product_detail&p=2964 Friendly: http://www.domain.com/product_name_here.html I have always heard mixed reviews but did an experiment comparing results on the same domain and actually noticed quite a difference with the friendly ones. Thanks!
Technical SEO | | 6thirty0 -
URL specific websites with i-framed application
I have 300 URL specific websites that rank well in Yahoo and Bing. Unfortunately I don't have access to the websites due to a previous marketing agreement (before my time). I do have access to the application that is i-framed into the websites. I was thinking about adding a paragraph below the application with a link to the primary website. How does google look at these links. If I add the link, there will be an additional 300 links showing up at the same time. Not what they want to see from my personal knowledge base. At the same time, its not black hat SEO, I am just trying to link to the other websites which I own which are related. What are people thoughts.
Technical SEO | | FidelityOne0