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
-
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 -
CNAME vs 301 redirect
Hi all, Recently I created a website for a new client and my next job is trying to get them higher in Google. I added them in OSE and noticed some strange backlinks. To my surprise the client has about 20 domain names. All automatically poiting to (showing) the same new mainsite now. www.maindomain.nl www.maindomain.be
Technical SEO | | Houdoe
www.maindomain.eu
www.maindomain.com
www.otherdomain.nl
www.otherdomain.com
... Some of these domains have backlinks too (but not so much). I suggested to 301 redirect them all to the main site. Just to avoid duplicate content. But now the webhoster comes into play: "It's a problem, client has only 1 hosting account, blablabla...". They told me they could CNAME the 20 domains to the main domain. Or A-record them to an IP address. This is too technical stuff for me. So my concrete questions are: Is it smart to do anything at all or am I just harming my client? The main site is ranking pretty well now. And some backlinks are from their copy sites (probably because everywhere the logo links to the full mainsite url). Does the CNAME or A-record solution has the same effect as a 301 redirect, from SEO perspective? Many thanks,
Hans0 -
301 redirect + new website copy
Hi There, We are currently redeveloping our website and we're rewriting and optimising our many of our service pages. I think I may already know the answer but should we apply 301 redirects from our old services pages to the new versions? The content subject matter will be the same on the new versions, they will just be completely reworded. I would be interested to hear your views. Thanks, Stu
Technical SEO | | Stuart260 -
Should we 301 redirect our old domain to the new domain
We have a product that when started was under the domain appnowgo.com. We've since changed the name and the domain is now knackhq.com. The latter domain doesn't rank nearly as well as the former for many of the keywords we are targeting. For example... "online database builder" and "web app builder" are two of those keywords. Obviously having app in the domain is not a bad thing but it is our old name. The question is, should we 301 the appnowgo.com domain to knackhq.com? Or should we use that better rank and just link users to knackhq.com from the appnowgo.com site until we can increase our ranking for knackhq.com? We don't plan to update the content on appnowgo.com anymore and we obviously don't want to drop off rank if at all possible. Thanks! Eric
Technical SEO | | sitestrux0 -
301 redirecting a mobile site.
Is it possible to selectively 301 redirect mobile/tablet user agents and google robots from the desktop version of a website to a mobile site? Would this preserve the SEO for the desktop website while optimizing the mobile/tablet site for mobile SEO?
Technical SEO | | inc.com0 -
Redirecting website page to another
Hi there one of my old pages on my site is currently ranking for a phrases that I want to rank for on a new page I created. My old page from 1 year ago is ranking for 'Property Management Training' (it's a blog post dating 2011) I have cretaed a new main Page on my site and would like to rank for 'Property Management' as it's more relevant. What is the best suggestion to keep my ranking but have people go to my new page? 301 redirect old page to new page? Thanks,
Technical SEO | | daracreative1 -
301 redirect dropped page rank
Hi, We have a www domain that I have changed to a non www domain. The www domain had been in place for some time and had a good page rank, PR4. After this change the page rank dropped significantly (PR0, and now recently back to PR2) despite it being a 301 redirect which I thought "should" carry over the page rank. Yes, I am aware I should have just left it be. Hind sight 20/20 .. ya ya ya 🙂 My questions Is the 301 the correct method for this? Why did the page rank drop despite the 301? Should we go back to the www domain at this point? Thanks Kris
Technical SEO | | adriot0 -
Do 301 redirects pass page rank quickly
Hi I have been asked to carry out a site audit for a potential client. The site has that many issues I don't where to start in explaining them however, there is one question we are debating and would like to get a second opinion on it. The site I am auditing used to have a homepage rank 7. The site has currently had a redesign (new template with new URLs) and now the root domain 301 redirects to a sub folder two levels deep (not ideal I know!). This happened about a month ago and we are still getting N/A for toolbar page rank. The question is, does Google page rank transfer quicker than normal due to the redirects? or do we still have to wait on the next Google Page Rank update? Thanks in advance Gavelect
Technical SEO | | Equatorites0