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
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
-
URL Change, Old URLs Still In Index
Recently changed URLs on a website to remove dynamic parameters. We 301'd the old dynamic links (canonical version) to the cleaner parameter-free URLs. We then updated the canonical tags to reflect these changes. All pages dropped at least a few ranking positions and now Moz shows both the new page ranking slightly lower in results pages and the old page still in the index. I feel like I'm splitting value between the two page versions until the old one disappears... is there a way to consolidate this quickly?
Technical SEO | | ShawnW0 -
Conversion of URL's for Readability
Reading over Rands latest Post about URL structure I had a quick question about the best way to convert URL's that don't have perfect URL structure... Current the Structure of our E-commerce store has a structure that is not friendly with domain.com/product/zdcd-jobd3d-fdoh what is the easiest way to convert these to read URL's without causing any disruptions with the SERP. Are we talking about a MOD-Rewrite in the CMS.......
Technical SEO | | CMcMullen0 -
How to find original URLS after Hosting Company added canonical URLs, URL rewrites and duplicate content.
We recently changed hosting companies for our ecommerce website. The hosting company added some functionality such that duplicate content and/or mirrored pages appear in the search engines. To fix this problem, the hosting company created both canonical URLs and URL rewrites. Now, we have page A (which is the original page with all the link juice) and page B (which is the new page with no link juice or SEO value). Both pages have the same content, with different URLs. I understand that a canonical URL is the way to tell the search engines which page is the preferred page in cases of duplicate content and mirrored pages. I also understand that canonical URLs tell the search engine that page B is a copy of page A, but page A is the preferred page to index. The problem we now face is that the hosting company made page A a copy of page B, rather than the other way around. But page A is the original page with the seo value and link juice, while page B is the new page with no value. As a result, the search engines are now prioritizing the newly created page over the original one. I believe the solution is to reverse this and make it so that page B (the new page) is a copy of page A (the original page). Now, I would simply need to put the original URL as the canonical URL for the duplicate pages. The problem is, with all the rewrites and changes in functionality, I no longer know which URLs have the backlinks that are creating this SEO value. I figure if I can find the back links to the original page, then I can find out the original web address of the original pages. My question is, how can I search for back links on the web in such a way that I can figure out the URL that all of these back links are pointing to in order to make that URL the canonical URL for all the new, duplicate pages.
Technical SEO | | CABLES0 -
Remove a directory using htaccess
Hi, Can someone tell me if there's a way using htaccess to say that everything in a particular directory, let's call it "A", is gone (http 410 code)? i.e. all the links should be de-indexed? Right now, I'm using the robots file to deny access. I'm not sure if it's the right thing to do since Google webmaster tools is showing me the link as indexed still and a 403 error code. Thanks.
Technical SEO | | webtarget0 -
301 from a Link Directory
Hey guys. I am more looking for advice to confirm something on this one if anyone could offer help? My client has a reciprocal only link directory that is actually ranking higher than their company website. Surely from an SEO point of view, in this instance, it would make sense to kill the link directory and put a re-direct on the whole thing over to their main site? Would appreciate any advice on this one 🙂
Technical SEO | | Nextman0 -
URL with tracking code
Hi there, At the company i am currently working for we have a problem with shortcut url with tracking in it. They send a lot of brochures with a shortcut URL which redirects to the page of the event with tagging. For example The real URL is:
Technical SEO | | RuudHeijnen
http://www.sbo.nl/cursussen/schoolleider-primair-onderwijs/ The URL in the brochure is:
www.sbo.nl/schoolleiderpo this then redirects to: h
ttp://www.sbo.nl/cursussen/schoolleider-primair-onderwijs/?utm_source=direct&utm_medium=shortcut&utm_campaign=schoolleiderpo Now we can measure the effect of the brochure on on-line traffic and conversion. This is great but a lot of website link to that shortcut url and if the event is put offline the links to it generate an 404. We have now about 800 backlinks that generate this 404 and i want to fix it. Another big problem "i think" is the possibility that google will index this url with tagging. Now i have 2 options: 1. look at al the url with that 404 and redirect them with a 301 to the best page 2. create the shortcut on an page that is most suitable but then i will get the tagging in the URL and i guess google will see this as dublicate content. It is possible that in the future the shortcut url will be used again. What would you suggest as the best sollution.0 -
Query string in url - duplicate content?
Hi everyone I would appreciate some advice on the following. I have a page which has some nice content on but it also has a search functionality. When a search is run a querystrong is run. So i will get something like mypage.php?id=20 etc. With many different url potentials, will each query string be seen as a different page? If so i don't want duplicate content. So am i best putting canonical tags in the head tags on mypage.php ? to avoid Google seeing potential duplicate content. Many thanks for all your advice.
Technical SEO | | pauledwards0 -
Blank Canonical URL
So my devs have the canonical URL loaded up on pages automatically, and in most cases this gets done correctly. However we ran across a bug that left some of these blank like so: Does anyone know what effect that would have? I am trying to provide a priority for this so I can say "FIX IT NOW" or "Fix it after the other 'FIX IT NOW' type of items". Let me know if you have any ideas. I just want to be sure I am not telling google that all of these pages are like the home page. Thanks!
Technical SEO | | SL_SEM0