301 Redirect non existant pages
-
Hi
I have 100's of URL's appearing in Search Console for example:
?p=1_1
These go to on to 5_200 etc..
I have tried to do htaccess and the mod rewrite is on as I can redirect directories to the root i.e
RewriteRule ^web_example(.*)$ /$1 [R=301,N,L]
However I have tried all kinds of variations to redirect ?p= and either it doesn't work at all or it crashes the website. Can anyone point me in the right direction to fix this.
-
RewriteCond %{QUERY_STRING} ^p=([0-9_])$
RewriteRule ^(.)$ /p/%1? [R=301,L]the above works on our test area but not on clients so it hosting issue
-
Thanks Chris
Seems there is an issue with the web host.
-
Hi James,
Assuming you want to keep the existing setup but set up friendlier URLs (example, redirect ?p=1_14 to /p/1_14), you could do something like this:
RewriteCond %{REQUEST_URI} ^p=([^&]+) [NC,OR]
RewriteCond %{REQUEST_URI} &p=([^&]+) [NC]
RewriteRule .* /p/%1? [R=301,L,NE]Then you'd want something to handle those new URL requests with something like this:
RewriteRule "^p/(.*)$" "/index.php?p=$1" [L,NE]
Hope this helps!
-
It's from an old website so the pages no longer exist. I will have a look at the link you sent over thank you.
-
Hi,
Something is generating those links, and that is what I would want to fix. It sounds like a module or add-on is incorrectly coded, or installed improperly. As p=1_1 is usually a form of pagination and / or sort order.
You could of course easily fix it by putting a canonical tag on the root page to itself or work out a mod rewrite rule, but that isn't actually fixing the problem. As soon as you add another category you may have to revisit the fix again.
Here is an example of using mod re-write on Stack Overflow: http://stackoverflow.com/questions/14666140/htaccess-rewriting-php-pagination
I hope that helps,
Don
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
-
Can a page that's 301 redirected get indexed / show in search results?
Hey folks, have searched around and haven't been able to find an answer to this question. I've got a client who has very different search results when including his middle initial. His bio page on his company's website has the slug /people/john-smith; I'm wondering if we set up a duplicate bio page with his middle initial (e.g. /people/john-b-smith) and then 301 redirect it to the existent bio page, whether the latter page would get indexed by google and show in search results for queries that use the middle initial (e.g. "john b smith"). I've already got the metadata based on the middle initial version but I know the slug is a ranking signal and since it's a direct match to one of his higher volume branded queries I thought it might help to get his bio page ranking more highly. Would that work or does the 301'd page effectively cease to exist in Google's eyes?
Technical SEO | | Greentarget0 -
Google Webmaster Warning for Non-mobile Optimized Pages
I just received a warning in Webmaster Tools that my site pages are not optimized for mobile devices and the search results for pages will be decreased in mobile searches. Just got it yesterday and I see no drop yet, but anyone else seen this???? The notice states that the site is not optimized for viewport, text size and proper space for clickable elements. All of that is true since we have not yet completed our responsive design conversion. Any idea if Google will give us a little time to get this resolved, or do my rankings start dropping right away? Just when you think you are moving forward with Google, they pull the rug out again...
Technical SEO | | gametv0 -
Best Practice - Disavow tool for non-canonical domain, 301 Redirect
The Situation: We submitted to the Disavow tool for a client who (we think) had an algorithmic penalty because of their backlink profile. However, their domain is non-canonical. We only had access to http://clientswebsite.com in Webmaster Tools, so we only submitted the disavow.txt for that domain. Also, we have been recommending (for months - pre disavow) they redirect from http://clientswebsite.com to http://www.clientswebsite.com, but aren't sure how to move forward because of the already submitted disavow for the non-www site. 1.) If we redirect to www. will the submitted disavow transfer or follow the redirect? 2.) If not, can we simply re-submit the disavow for the www. domain before or after we redirect? Any thoughts would be appreciated. Thanks!
Technical SEO | | thebenro0 -
Best & easiest way to 301 redirect on IIS
Hi all, What is the best and easiest way to 301 redirect URLs on IIS server? I got access to the FTP and WordPress back office, but no access to the server admin. Is there an easy way to create 301 redirect without having to always annoy the tech in charge of the server? Thanks!
Technical SEO | | 2MSens0 -
Another 301 redirect question - penalty?
Good Morning, We have 2 sites have images and minimal text on them. The images have links that point to a 3<sup>rd</sup> site that facilitates eCommerce. Question: If we 301 redirect these sites permanently to yet a 4<sup>th</sup> site… 1) Does it violate any G’s guidelines 2) Should we delete the links embedded in the images (as they point to the 3<sup>rd</sup> site) Thanks
Technical SEO | | Prime850 -
301 redirects tanked our site on google - what now?
We had several hundred old pages on the site with duplicate content and new pages with fresh info on the same topics. So I redirected the old pages to the new pages. Next day, plop, we're dumped off google for almost every keyword. Dang I thought they didn't want duplicate content and old funky pages. What did I do wrong and what can I do to fix it? Thanks so much for anyone who can share their expertise. Jean
Technical SEO | | JeanYates0 -
Why is a 301 redirected url still getting indexed?
We recently fixed a redirect issue in a website, and although it appears that the redirection is working fine, the url in question keeps on getting crawled, indexed and cached by google. The redirect was done a month ago, and google shows cached version of it, even for a couple of days ago. Manual checking shows that its being redirected, and also a couple of online tools i checked report a 301 redirect. Do you have any idea why this could be happening? The website I'm talking about is www.hotelmajestic.gr and its being redirected to www.hotel-majestic.gr
Technical SEO | | dim_d0 -
I think I'm stuck in a 301 redirect loop
Hi all, I'm trying to correct some of my duplicate content errors. The site is built on Miva Merchant and the storefront page, /SFNT.html, needs to be permanently redirected to www.mydomain.com This is what my .htaccess file looks like: #RedirectPermanent /index.html http://dev.mydomain.com/mm5/merchant.mvc? RewriteEngine On RewriteCond %{HTTP_HOST} !^dev.mydomain.com$ [NC] RewriteRule ^(.*) http://dev.emydomain.com/$1 [L,R=301] DirectoryIndex index.html index.htm index.php /mm5/merchant.mvc redirect 301 /SFNT.html http://dev.mydomain.com/ RewriteCond %{QUERY_STRING} Screen=SFNT&Store_Code=MYSTORECODE [NC] When I use this code and navigate to http://dev.mydomain.com/SFNT.html the URL gets rewritten as http://dev.mydomain.com/?Screen=SFNT So I believe this is what's called a "redirect loop".... Can anyone provide any insight? I'm not a developer, but have been tasked with cleaning up the problems on the website and can use any input anyone is willing to offer. Thanks, jr
Technical SEO | | Technical_Contact0