How can I redirect anything after the article url to main article?
-
Hello everyone,
When someone visits my websites article like http://www.website.com/article-title/lol , it give to 404 page error. But when someone http://www.website.com/article-title/ , it shows the article. The word "lol" can be changed to anything. I would like that to be redirected to the main article.
Example: Someone visits website.com/article-title/lol, they should be redirected to website.com/article-title/
Is it possible to do so? If yes, please tell me how.
Note: I'm using WordPress
Thank you
-
Here is the mod_rewrite code that would go in your Wordpress .htaccess file that would redirect
http://www.website.com/article-title/lol
to this:
http://www.website.com/article-title/
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^article-title/lol(.*)$ http://www.website.com/article-title/$1 [r=301,nc]Make a note of this Mod_Rewrite Tool and it should help you with similar rules in the future.
Hope that helps!
-
Thanks Lkkie,
It would be really kind of you if you can get me the .htaccess code which will help me fix my problem stated above.
-
You simple need to define your URL rules through htaccess file this will resovle your issue.
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
-
Toxic URL???
Hi I have a URL that produced page 1, number 1 to 3 for most of our industries top phrases. Then we received a google penalty, (as did several of our competitors on the same day). We were effectively wiped from google. After much disavowing we were allowed back into the search results, this took about 3 months. I have employed the services of a top London SEO company for over a year now and have seen no significant improvement. I believe they are doing there best, however there results are VERY poor. According to the various tools, (searchmetrics, woorank, semrush) to name but a few, our site scores very well, yet we are not getting the results. Page one seems to be full of totally new websites, most of which I have never heard of, and have appeared from nowhere. Should I scrap our URL and put up a completely new one, and put a redirect from the original one? This would be a biggy since our url has been around for 20 years. Thanks for reading. Andy
On-Page Optimization | | First-VehicleLeasing0 -
Duplicate URL errors when URL's are unique
Hi All, I'm running through MOZ analytics site crawl report and it is showing numerous duplicate URL errors, but the URLs appear to be unique. I see that the majority of the URL's are the same, but shouldn't the different brands make them unique to one another? http://www.sierratradingpost.com/clearance~1/clothing~d~5/tech-couture~b~33328/ http://www.sierratradingpost.com/clearance~1/clothing~d~5/zobha~b~3072/ Any ideas as to why these would be shown as duplicate URL errors?
On-Page Optimization | | STP_SEO0 -
can we include iframe content if we properly reference the source in the url?
can we safely include iframe content if we properly source the source url. eg we have a travel company we are looking to produce another website, but use the same hotel descriptions in the hotel directory. can we do this?
On-Page Optimization | | Direct_Ram0 -
Value of URL Changes
Hi Guys, I have a question. Each product listed on my webstie has product number like /product.php?id=3624. After I spent many hours with MOZ, I figured out that this approach is wrong and I should use the product name as URL to achieve better SEO performance. Now I am planing to change the URL generating algoritm but should I do it for existing products. Some of them have already been linked to external websites. I am thinking to create mirror URLs but this may cause rather damage on my website. Do you know what is the right answer? Best, Tony
On-Page Optimization | | Threeding.com0 -
Prevent Indexing of URLs Based on Tags
I started my website as a blog over at Posterous, but decided to turn it into a full scale business website with a self-hosted WordPress theme. Shortly after transitioning from Posterous to WordPress, I noticed that Google was indexing not only my old blog posts, but the URLs of my blog posts based on the tags they have. Is there any reason why this is a problem? I'm sure it shouldn't qualify as duplicate content, but for some reason it just feels a bit sloppy to me to have all of these pages indexed...Is this a non-issue? Should I just be more discriminating with my use of 'tags' if it bothers me? JiGLH.png
On-Page Optimization | | williammarlow0 -
New sitelinks - can we control the number?
A quick question on Google's new sitelink format. When searching for our brand name (Confetti) Google returns 8 sitelinks for our site. When searching for our domain (confetti.co.uk) Google returns the maximum number of 12 sitelinks. Is there a quick way (Webmaster Tools for example) to increase the number of sitelinks for our brand name to 12? Thanks,
On-Page Optimization | | Confetti_Wedding0 -
Product sorting and dynamic urls
On our weekly SEOmoz crawls, we get thousands of warnings about overly dynamic URLs as a result of our product sorting options at the top of our category pages. It seems like the ability to sort products by price, name, etc., is nice for the customer. For SEO is this really a problem or can we ignore these warnings?
On-Page Optimization | | teatable0 -
Duplicate product urls
Our site automatically creates shorter urls for the products. There is a rel canonical tag in place, but webmaster tools shows these urls have duplicate title tags. Here is an example: http://www.colemanfurniture.com/holden-desk.htm http://www.colemanfurniture.com/writing-desks-secretary-desks/holden-desk.htm Should the longer url be redirected to the shorter one?
On-Page Optimization | | thappe0