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
-
Google selecting incorrect URL as canonical: 'Duplicate, submitted URL not selected as canonical'
Hi there, A number of our URLs are being de-indexed by Google. When looking into this using Google Search Console the same message is appearing on multiple pages across our sites: 'Duplicate, submitted URL not selected as canonical' 'IndexingIndexing allowed? YesUser-declared canonical - https://www.mrisoftware.com/ie/products/real-estate-financial-software/Google-selected canonical - https://www.mrisoftware.com/uk/products/real-estate-financial-software/'Has anyone else experienced this problem?How can I get Google to select the correct, user-declared canoncial? Thanks.
Technical SEO | | nfrank0 -
Old URLs Appearing in SERPs
Thirteen months ago we removed a large number of non-corporate URLs from our web server. We created 301 redirects and in some cases, we simply removed the content as there was no place to redirect to. Unfortunately, all these pages still appear in Google's SERPs (not Bings) for both the 301'd pages and the pages we removed without redirecting. When you click on the pages in the SERPs that have been redirected - you do get redirected - so we have ruled out any problems with the 301s. We have already resubmitted our XML sitemap and when we run a crawl using Screaming Frog we do not see any of these old pages being linked to at our domain. We have a few different approaches we're considering to get Google to remove these pages from the SERPs and would welcome your input. Remove the 301 redirect entirely so that visits to those pages return a 404 (much easier) or a 410 (would require some setup/configuration via Wordpress). This of course means that anyone visiting those URLs won't be forwarded along, but Google may not drop those redirects from the SERPs otherwise. Request that Google temporarily block those pages (done via GWMT), which lasts for 90 days. Update robots.txt to block access to the redirecting directories. Thank you. Rosemary One year ago I removed a whole lot of junk that was on my web server but it is still appearing in the SERPs.
Technical SEO | | RosemaryB3 -
Adding parameters in URLs and linking to a page
Hi, Here's a fairly technical question: We would like to implement badge feature where linking websites using a badge would use urls such as: domain.com/page?state=texas&city=houston domain.com/page?state=neveda&city=lasvegas Important note: the parameter will change the information and layout of the page: domain.com/page Would those 2 urls above along with their extra parameters be considered the same page as domain.com/page by google's crawler? We're considering adding the parameter "state" and "city" to Google WMT url parameter tool to tel them who to handle those parameters. Any feedback or comments is appreciated! Thanks in advance. Martin
Technical SEO | | MartinH0 -
Google is indexing my directories
I'm sure this has been asked before, but I was looking at all of Google's results for my site and I found dozens of results for directories such as: Index of /scouting/blog/wp-includes/js/swfupload/plugins Obviously I don't want those indexed. How do I prevent Google from indexing those? Also, it only seems to be doing it with Wordpress, not any of the directories on my main site. (We have a wordpress blog, which is only a portion of the site)
Technical SEO | | UnderRugSwept0 -
Long URL
I am using seomoz software as a trial, it has crawled my site and a report is telling me that the URL for my forum is to long: <dl> <dt>Title</dt> <dd>Healthy Living Community</dd> <dt>Meta Description</dt> <dd>Healthy life discussion forum chatting about all aspects of healthy living including nutrition, fitness, motivation and much more.</dd> <dt>Meta Robots</dt> <dd>noodp, noydir</dd> <dt>Meta Refresh</dt> <dd>Not present/empty</dd> <dd> 1 Warning Long URL (> 115 characters) Found about 17 hours ago <dl> <dt>Number of characters</dt> <dd>135 (over by 21)</dd> <dt>Description</dt> <dd>A good URL is descriptive and concise. Although not a high priority, we recommend a URL that is shorter than 75 characters.</dd> </dl> </dd> <dd> URL: http://www.goodhealthword.com/forum/reprogramming-health/welcome-to-the-forum-for-discussing-the-4-steps-for-reprogramming-ones-health/ The problem is when I check the page via edit or in the admin section of wordpress, the url is a s follows: http://www.goodhealthword.com/forum/ My question is where is I cannot see where this long url is located, it appears to be a valid page but I cant find it. Thanks Pete </dd> </dl>
Technical SEO | | petemarko0 -
Block url with dynamic text in
I've just ran a report and I have a lot of duplicate page titles, most of which seem to be the review page, I use Magento and my normal url would be something like blah-blahtext.html but the review url is something like blah-blahtext/reviews/category/categoryname So I want to block the /reviews url bit as no one ever leaves reviews and it's not something I will be using in the future. Also I have a dynamic navigation which creates urls that look like product-name.html?size=2&colour=14 these are also creating duplicate urls, anyway to fix this? While I'm asking, anyone any tips for Magento?
Technical SEO | | Beermonster0 -
301 redirects and Dynamic URLs
I just ran my first diagnostic and one of my primary immediate problems are duplicate titles and duplicate content. My guess it that because the root URL http://sitename.com (which has not yet been redirected to www...) has generated an entire tree of content which is identical to the tree rooted at http://www.sitename.com. QUESTION: Do I need to do a redirect simply for the root url (sitename.com -> www.sitename.com) or do I now need to develop specific 301 redirects for each of the sub-nodes/pages? ie sitename.com/?q=about-us -> www.sitename.com/?q=about-us sitename.com/?q=our-team -> www.sitename.com/?q=our-team etc.
Technical SEO | | Barrycliff680 -
Canonical Tag Pointing To The Same URL
Does it matter if a canonical tag points to the URL in which the tag is on? Example Page: http://www.domain.com Canonical tag: rel="canonical" href="http://www.domain.com" /> I only ask because a client of mine has a CMS that automatically does that to every page on the site and there's no way to remove it. Will this have a negative impact or does it not matter at all? Any insights would be great because I can't find a clear answer anywhere online. Thanks!
Technical SEO | | MichaelWeisbaum0