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
-
Unsolved Temporary redirect from 302 to 301 for PNG File?
#302HTTP #temporaryredirect
Technical SEO | | Damian_Ed 0
Hi everyone, Recently I have faced a crawl issue with my media images on website. For example this page url https://intreface.com/wp-content/uploads/2022/12/Horion-screen-side-2.png has 302 HTTP Status and the recommendation is to change it 301. I have read the article on temporary redirections here:
https://moz.com/learn/seo/redirection?_ga=2.45324708.1293586627.1702571936-916254120.1702571936
but its not written here how to redirect in my HTML 1 image url not the landing page.
Screenshot 2023-12-15 at 11.02.40.png
I have messaged to MOZ Support but they recommended to go for the MOZ Community!
Screenshot 2023-12-15 at 11.06.02.png Could you assist me wit this issue please? I can reach HTTML of the necessary page and change what I need for permanent redirection but firstly I need to understand how to do that correctly.0 -
301 Redirects a Year Later
I inherited the digital maintenance of a website that was relaunched a year ago. In looking at Google Analytics, organic search a year later is still down 33%. I fear they did not install 301 Redirects but can't really get a specific answer from them. Is it possible to install them a year later to help with Google indexing and get back some of the organic traffic?
Technical SEO | | stansamples0 -
Switched from and HTTPS to HTTP. My home page is facing a redirect issue from the http to https. Should I no index the HTTP or find the redirect and delete it? Thank you
Switched from and HTTPS to HTTP. My home page is facing a redirect issue from the http to https. Should I no index the HTTP or find the redirect and delete it? Thank you
Technical SEO | | LandmarkRecovery20170 -
Does 301 redirect cause penalty
Good Morning, I am considering doing a 301 (permanent) re-direct of roughly 100 domains, split between my 3 main e-commerce sites. Would taking an action like this put any of the 100 domains or any of the 3 recipient domains at risk of violating G's guidelines? Thanks...
Technical SEO | | Prime851 -
Redirecting internal pages to another domain
Hi, I recently redirected the domain www.organic7thheaven.com to http://www.7thheavennaturals.com/ However, the internal pages of www.organic7thheaven.com such as http://www.7thheavennaturals.com/products/sensitivesouls/ are now displaying a 404 Not Found Message How can I have it so that pages such as the above automatically also redirect to http://www.7thheavennaturals.com/ Thanks!
Technical SEO | | MJMarketing0 -
Rel=cannonical + 301 redirect
Hi All I am currently working on a DotNetNuke site. I have enabled friendly URL's which have changed the url structure from the default setting of TabId=x to whatever the page name is set as. I will use the following page as an example - www.notarealdomain./graphicdesign.aspx Now I would like to know if it would be worth my time to change this to "/graphic-design.aspx through the use of a 301 redirect and/or a rel=can. Any help would be much appreciated. Thanks
Technical SEO | | masterpete0 -
301 Redirect Domain or 301 Redirect Domain + Interior Pages
Hello - My company acquired another company in our industry and our IT team immediately set up the acquired companies domain name as a an alias to our site. This created a duplicate version of our website under another domain name and Google started ranking interior pages from the aliased acquired site for several top keywords that were previously held by our real site. Should we 301 redirect just the top level domain name of the acquired site to the real site or 301 redirect the top level domain name and the interior pages on the acquired site to help ensure that our real domain will take back the rankings it once had? Thanks!
Technical SEO | | Room2140 -
301 redirect
We have just had an outside SEO agency report on our site: One of things brought up were arounf broken links, and how they class them as broken links. Could any body tell me whether this statement holds true please, as I am not aware of this "Our latest intelligence shows that google are downgrading ranking from sites that feature 301 redirects within the internal link structure". Any help would be greatly appreciated Regards
Technical SEO | | Yozzer0