Htaccess redirect veriables
-
Hey,
I'm trying to redirect all instances of "/archive_details.php?id=*" to "/public-affairs-job-archive.php". Is the below code correct?
Redirect 301 /archive_details.php?id=* /public-affairs-job-archive.php
Thanks, Luke.
-
Exactly what i was looking for.
Thanks!
-
Your construction is not correct because the second parameter in your redirect, the url you are redirecting to, needs to be the full url, like this: http://www.yourdomain.com/public-affairs-job-archive.php
If you need to redirect any URLs matching a phrase you can use RedirectMatch -it performs a regular expression redirect.
In your case the redirect will look like this:
RedirectMatch 301 /archive_details.php?id=(.*) http://www.yourdomain.com/public-affairs-job-archive.php
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
-
Browser Cacheing - HTTPS redirects to HTTP
Howdy lovely Moz people. A webmaster redirected https protocol links to http a number of years ago in order to try and capture as many links as possible on a site we now manage. We have recently tried to implement https and realised that because of this existing redirect rule, they are now causing infinite loops when trying to test an http redirect. http redirecting to https redirecting back to http, etc. The https version works by itself weirdly enough. We believe that this is due to the permanent browser caching. So unless users clear their cache, they will get this infinite loop. Does anyone have any advice on how we can get round this? a) index both sites and specify in GSC that the https is the canonical version of the site and hope that Google sees that and removes the http version for the https version b) stick with http as infinite loops will kill the site c) ??????????? Thanks all.
Intermediate & Advanced SEO | | HenryFrance0 -
Several 301 Redirects to Same Page
Hi, I have 3 Pages we won't use anymore in our website. Let's call them url A, url B and url C. To keep their SEO strength on our domain, I've though about redirecting all of them to url D. For what I understand, when 301 redirecting, about 85-90% of the link SEO juice is passed. Then, if I redirect 3 URLs to the same page... does url D receive all the link SEO juices for URLs added up? (approximately)
Intermediate & Advanced SEO | | viatrading1
e.g. future url D juice = 100% current url D juice + 85% url A juice + 85% url B juice + 85% url C juice Is this the best practice, or is there a better way? Cheers,0 -
Help understanding 301 domain redirect
Can anyone help me understand a specific process of a 301 redirecting a domain. Here is what I would like to know.... When you 301 redirect a site, most if not all the links follow to your new site. But how does this process happen? 1.When Google sees the new domain does it simply apply the backlink profile of the old site to the new one? 2. Does it have to re-crawl all the links one by one and apply them to the new domain? 3. or something else?
Intermediate & Advanced SEO | | gazzerman10 -
Should you cache redirects?
I would like to know what fellow SEO people think, should you cache a redirect? Problems I see with caching redirects are meta refreshes and there might be a slow down in page load, but is it a big issue? Should we cache redirects? Do pages get indexed more if you cache redirects? Our ecommerce product pages are all dynamic, and currently we cache redirects but i'm seeing a lot of meta refresh issues. Another area that cropped up is that, the redirect doesn't pass on query parameters. Our system dumps URLs and they are redirected to SEO ones, but the redirect doesn't pass on parameters like Google Analytic tracking tags. What are your thoughts? Thanks
Intermediate & Advanced SEO | | Bio-RadAbs0 -
How can i redirect my site to other domain ?
I have been running an eCommerce site since 2008 and have a PR3 with mostly have an authority link from reputed sites, how can I transfer my existing eCommerce site to the new domain so in the new domain i get SEO value from the old domain. Please advice.
Intermediate & Advanced SEO | | chandubaba0 -
How to decide on which site to 301 redirect
Hi there I'd like your opinions please! My client currently has their website at not-very-good-url.it which has a really good link profile they also have duplicate sites at: much-better-brand-name-url.it and much-better-brand-name-url.com but both these other sites have only a handful of links in. How important do you think a better brand url is? And therefore do you think it would be better to 301 to a better brand URL and take the risk that the link profile will get hit? Or leave the main site where it is and 301 the other two to it? Many thanks
Intermediate & Advanced SEO | | Chammy0 -
HT.Access Redirect Question
Quick question on the HT.Access / Redirects... II have a site http://www.securitysystemsfortlauderdale.org/ADT-Home-Security-Alarm-Systems/ and I am running througth SEO moz for backlinks and noticed a large descrepancy on the links on the root vs the redirect. There are more links on the root and less on the redirect. Does this affect SEO for Google or does Google follow the redirects and give credit accordingly. Thanks for your help!!! Matt
Intermediate & Advanced SEO | | joeups0 -
Keyword-Rich Domains - Redirect?
Hi, Mozzers- I have a client that has a bunch of pretty nice keyword-rich domain names. Their traffic and rankings are good. They provide legal services in the Chicago area. I have lots of good content that I could use to start a blog using a domain like keyword,keyword-blog.com. Good idea? Currently I have a resources area on their website but feel like this area could be getting a little bloated and some news-related stuff isn't really appropriate. 2 Questions: Should I use one of the decent domains for a blog and build up the rankings, traffic, and link to the main site? Or is this lots of work for little payout? Both sites would be hosted in the cloud. Some of the domain names are related to their name, others are keyword or geo-targeted. Would it be wise to setup 301 redirects going to their website? Pros/cons? If you need additional info, please PM me for details. Thank you, friends! LHC
Intermediate & Advanced SEO | | lhc670