Apache .htaccess query string redirects
-
With regular redirect(s) the following URLs did not work, any ideas for the .htaccess code to make this work?
http://www.domain.com/?view=featured redirect to http://www.domain.com/
http://www.domain.com/contact-us.html?view=message&layout=message&pf=1&redirect_on_success= to http://www.domain.com/contact-us.html
and
http://www.domain.com/login.html?return=aW5kZXgucGhwP29wdGlvbj1jb21fcGhvY2Fkb3dubG9hZCZ2aWV3PWNhdGVnb3J5JmlkPTEyOmNvbWJpbmUtZXZhbHVhdGlvbiZJdGVtaWQ9NzM4 to http://www.domain.com/login.htm
Thanks guys!
-
Hi Dan,
Thanks for this! I had initially asked and then without getting an answer had to go dig around and figure this out myself. At the end of the day I made it happen!
Thanks for looking through this again. Ill mark it as answered!
-
Hi Vadim
Did you have any luck with this? I found a few resources that might help (I don't have intimate experience with writing special .htaccess redirects):
-
Hi Vadim,
I am not providing you exact 301 redirect code for above URL but I have found a detailed article posted on this post that might be helpful for you but not very sure.
http://www.goinflow.com/setting-up-301-redirects-for-dynamic-urls/
Hope this helps.
Thanks
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
-
Weird 404 Error URL's - Where to redirect?
For some reason, I end up with a bunch of weird 404 error URLs like these. /KRVWZ/SVfSZ/ /wp-content/upl /MKWTZ/RKYQZ/ /wp-content/upload What should I do with them? Should I redirect them or is there a better way to do something with them. I do use Yoast Premium if that makes a difference. Thanks in advance.
On-Page Optimization | | photoseo10 -
SERP Hijacking/Content Theft/ 302 Redirect?
Sorry for the second post, thought this should have it's own. Here is the problem I am facing amongst many others. Let's take the search term "Air Jordan Release Dates 2017" and place it into Google Search. Here is a link:
On-Page Optimization | | SneakerFiles
https://www.google.com/#q=air+jordan+release+dates+2017 Towards the bottom of the page, you will see a website that has SneakerFiles (my website) in the title. The exact title is: Air Jordan Release Dates 2016, 2017 | SneakerFiles - Osce Now, this is my content, but not my website. For some reason, Google thinks this is my site. If you click on the link in search, it automatically redirects you to another page (maybe 302 redirect), but in the cache you can see it's mine:
http://webcache.googleusercontent.com/search?q=cache:qrVEUDE1t48J:www.osce.gob.pe/take_p_firm.asp%3F+&cd=8&hl=en&ct=clnk&gl=us I have blocked the websites IP, disallowed my style.css to be used so it just shows a links without the style, still nothing. I have submitted multiple google spam reports as well as feedback from search. At times, my page will return to the search but it gets replaced by this website. I even filed a DMCA with Google, they declined it. I reached out to their Host and Domain register multiple times, never got a response. The sad part about this, it's happening for other keywords, for example if you search "KD 9 Colorways", the first result is for my website but on another domain name (my website does rank 3rd for a different Tag page). The page I worked hard on keeping up to date. I did notice this bit of javascript from the cloaked/hacked/serp hijacking website: I disabled iFrames...(think this helps) so not sure how they are doing this. Any help would be greatly appreciated. Note: I am using Wordpress if that means anything.0 -
Can we change Title and/or Descriptions Dynamically Based on Search Query
If I recall we used to be able to change our title attributes tag dynamically based on the search query but not sure if it's possible now or if it makes sense to do so. Thoughts? Rosemary
On-Page Optimization | | RosemaryB1 -
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 -
Query string parameters and canonical links
Hello everyone, My site uses query string parameters in a few places to manage tasks like pagination of lists. Eg: http://www.example.com/destinations/somewhere?page=2 I have set a canonical link with the href of the page without the query string but still getting thousands of duplicate title/meta description reports from these pages. Is there something I can do to change this? Do search engines actually penalise for use of query string parameters like this? They seem so commonplace, even for sites which use an absolute URI with no query string to serve content. Thanks 🙂
On-Page Optimization | | JHWXS0 -
Will changing a site from https to normal http have any SEO impact if we do automatic redirects?
We currently have a site which uses https and want to change to normal http only (for reasons unrelated to SEO). We were planning to do this with a change in our server configuration (we use Nginx, and can automatically redirect https to http). Our site has been around for approx 1 year, so there are links floating around in the Internet which will still be using https. These will be automatically redirected to http. What will be the impact on our SEO? I understand that our webmaster tools account may need to change...
On-Page Optimization | | michaelcho0 -
How Much Does a Missing www. 301 redirect hurt a business?
We're preparing a report for a potential client, and are trying to figure out a way to estimate rankings gains. One of the major issues is a lack of a 301 redirect for non-www. domains to www. domains. We checked and there's no canonicalization, so it's a clear issue. According to Google, the non-www. links from 8 different domains. The www. version of the website has links from 248 different domains. Nearly all anchor text is branded, as they've never had any SEO work done before. Does anyone have a suggestion for approximating benefits of setting up their .htaccess file correctly? Would the benefits even be that great? We're of course advising additional things, but we just want to be more certain about this step's SEO-boost.
On-Page Optimization | | FlynnZaiger0 -
What does this mean on first step up setting up a campaign? "Having two "twin" domains that both resolve forces them to battle for SERP positions, making your SEO efforts less effective. We suggest redirecting one, then entering the other here."
I am BRAND new to this, and setting up my first campaign. I choose subdomain, and entered www.pdsaz.com. This is the message I receive: We have detected that the domain www.pdsaz.com and the domain pdsaz.com both respond to web requests and do not redirect. Having two "twin" domains that both resolve forces them to battle for SERP positions, making your SEO efforts less effective. We suggest redirecting one, then entering the other here.
On-Page Optimization | | cschwartzel0