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 Code Needed.
Hi, Please help me redirect the following pages in htaccess. https://www.mydomain.com/FolderA/FolderB/number-of-pages.html to **https://www.mydomain.com/FolderA/FolderC/FolderB/number-of-pages.html ** I want to redirect atleast 50 pages like this. Please help Thanks
On-Page Optimization | | Kashif-Amin0 -
Removing old URLs from Google
We rebuilt a site about a year ago on a new platform however Google is still indexing URL's from the old site that we have no control over. We had hoped that time would have 'cleaned' these out but they are still being flagged in HTML improvements in GWT. Is there anything we can do to effect these 'external' dropping out of the indexing given that they are still being picked up after a year.
On-Page Optimization | | Switch_Digital0 -
Results clustered in blue below the main result
There are multiple results that appear in blue below the main result for a query from a particular domain. For example, if I search 'mobile phones online' on google.co.uk, the result field from www.dialaphone.co.uk shows me multiple results clustered in blue - 'HTC One Silver', 'Samsung', 'iPhone5S', 'Free Gifts'. I am trying to understand what these are, and why these show up. Ideally, I would like the results for my domain to show up in a similar fashion, and am wondering if there is something special that I would need to do in this regard. Thanks
On-Page Optimization | | rjchugh0 -
301 vs 302 redirect
Hello Mozers, I have a website which offers subscriptions on a monthly basis, when one profile expires the link of the profile gets a 301 redirect to the main category, just that if the member chooses to come back after a while he can reactivate the profile and the link will work again and the 301 will disappear, Should I be doing 302 redirect, as from this point of view it's only a temporarily redirect ? Thanks in advance
On-Page Optimization | | asmedia0 -
New jobboard: Can redirecting folder (site.com/jobboard) to subdomain (jobboard.site.com) hurt SEO?
Hi there, I'm planning to implement a jobboard on my website which needs to be installed on a subdomain (jobboard.site.com) but I'd really like to use site.com/jobboard for promoting this jobboard (jobboard collects external industry jobs). Are there any possible disadvantages when I set up a 301 redirect from jobboard.site.com to site.com/jobboard? Also: What if I want to move this jobboard to a unique domain one day (e.g. jobboard-industry-xy.com), Would that be tricky (as I'd basically have to redirect the folder-to-subdomain redirect to an external domain and therefore get a folder-to-subdomain-to-external-domain redirect...)? Cheers, Thomas
On-Page Optimization | | stl990 -
Changing to Friendly SEO Urls
This is my site, example of a product : [Link removed] Would I lose rank in Google for changing all to friendly SEO urls? Thank you
On-Page Optimization | | 7liberty0 -
How can I find these pages?
Hi there! the SEOMOZ software has shown some warnings related to two pages that I can't locate in my WP plattform http://www.tarifakitesurfcamp.com/contacto/estrella/ http://www.tarifakitesurfcamp.com/equipo/equis Any ideas? Many Thanks
On-Page Optimization | | juanmiguelcr0 -
301 redirect link
Hi, I found some explanations on seomoz about permanently links, but I'm not sure, if I understood right, what to do. Our website has been created with a wrong structure and I have to change the URL of a couple of pages. E. G. http://www.ix-tours.com/Youth/ixdestBrusselYouth.aspx should be changed to http://www.ix-tours.com/DE/Jugend/BruesselJ.aspx to allow search identify it as a german page. What to do? Should I delete all content from the old page and insert the redirect to the knew one? The code as follows has to be inserted in the head section? Thank you for your help Brgds georg
On-Page Optimization | | itmlage0