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
-
Redirect issue
http://www.themorrisagency.co.uk/wedding-band redirects to http://www.themorrisagency.co.uk/wedding-band-cost-much-hire/ NO canonical in place. Nothing in Htaccess. I cant think where else to look to find it. If I amend it to http://www.themorrisagency.co.uk/we it still redirects. Any ideas? I have spent way too long on it now
On-Page Optimization | | agentmorris10 -
Redirect question
Hi Everyone I've tried searching elsewhere in these forums for an answer to this but not having much luck - hope I'm not duplicating content! I get this message in Moz: "We have detected that the domain NappyValleyNet.com redirects to www.nappyvalleynet.com. We do not recommend tracking a redirect URL. Would you like to track www.nappyvalleynet.com for this campaign instead?" Is this a set-up issue on my side? I'm not sure what this means? Thank you!
On-Page Optimization | | NappyValleyNet0 -
To update or not to update news URLs ?
We manage a huge daily news website in my small country - keeping this a bit mysterious in case competitors are reading 🙂 Our URL structure is www.companyname.com/news/categoryofnews/title-of-article?id=articleid In this hyperreactive news world, title of articles change frequently (may be ten times a day for the main stories). The question we debate is : should we reflect the modification of the title in the URL or not ? Example : "Trump says he wants to ban search engines" would have URL http://www.companyname.com/news/entertainment/Trump-says-he-wants-to-ban-search-engines?id=12345678 Later in the day the title becomes "Trump denies he suggested banning search engines". Should the URL be modified to http://www.companyname.com/news/entertainment/Trump-denies-he-suggested-banning-search-engines?id=12345678 (option A) or not (option B) ? In Google News it makes no difference because of the sitemap, but in Google organic things are different. At present (option B in place), Google apparently doesn't see that the article has been updated, and shows the initial timestamp which is visually (and presumably SEOwise) not good : our new news looks like old news. Modifiying the URL would solve that issue, but could, may be, create another one : the new URL, being considered a new article, would lose, the acquired weight of the previous one in terms of referrals, social trafic and so on. Or not ? What do you think is the best option ? Thanks for your expertise, Yves
On-Page Optimization | | yves678901 -
URL Keyword Variations?
I'm aware that keywords in the url aren't as effective as they used to be, but I'm still convinced that they do have a significant impact (based on results in one of the niches I'm in). My question is, will variations of keywords and "hidden" keywords have as much value as an exact keyword? For example, let's say that I'm trying to target the keyword "day." Will including variations like "daily" in the url work just as well? What about a brand name that includes the keyword hidden in its name, like "Dayest"? And, as a followup question, does including "stop" words have any effect? For example, if I'm trying to target the keyword "Day of the Month", would including "day" and "month" in the url be just as effective as including "day of the month"?
On-Page Optimization | | JABacchetta0 -
Mixing hyphens and underscores in a url
Hello. I am working on a site that was built with underscores in the urls, but only in the page names, not in the subdirectories. All the subdirectories have one-word names. So a typical url is "example.com/sub1/sub2/page_name." We would like to change the name of one of the subdirectories to a name that would be very useful for SEO, but this new name is a hyphenated word, let's call it "new-sub." If we changed "sub2" to "new-sub" then our url would have a mix of underscores and hyphens: example.com/sub1/new-sub/page_name. But if I used "new_sub" instead, google would read the words as connected with an underscore, instead of reading the subdirectory as a hyphenated word, which would be less useful for SEO. It seems like it might be a problem to have a hyphen in a subdirectory and underscores in the page names. But I want the SEO value of the hyphenated word. Any recommendations? Thank you!
On-Page Optimization | | nyc-seo0 -
Page authority 1 for new URLs
Hi There Quite a beginner question. I have changed url structure last week and is already avaliable on google.What i find strange is that the PA reported by SEOMOZ is 1 and there's no google cache. If the page has to crawled yet, why it's avaliable on google index already? Dario
On-Page Optimization | | Mrlocicero0 -
Long Url but makes no sense
Hi Just joined. Crawl states that I am getting a lot of errors, looks like the spider is getting confused and looping back on itself ? Is there a way to see where the crawl was formulated (ie where from) ? It is generating urls like: http://www.wickman.net.au/wineauction/wine_auction_alert.aspx/auction/auction/auction/auction/auction/auction/Default.aspx from http://www.wickman.net.au/wineauction/wine_auction_alert.aspx
On-Page Optimization | | blinkybill0 -
Redirecting a Parked Domain
A client's friend has had a parked domain for over 11 years. He has done nothing with it but throw a couple of ads on it. It has some traffic, most likely from typos: the domain domain is somewhat similar to a leading search engine. But the parked domain has no content, no links, no DA. I can't see the benefit of the redirect. My client might get a little traffic -- but the parked domain has nothing to do with his niche. Am I missing something? Is there any risk involved in the redirect (beyond unqualified traffic that isn't valuable?)
On-Page Optimization | | DanielFreedman0