301 Redirect From Dynamic Page To Static
-
I want to 301 redirect all "id" and "type" numbers from my page dynamic.php page (I have thousands of IDs and thousands of Types) all to a single URL.
So for example the following....
www.mysite.com/dynamic.php?id=1&type=5
www.mysite.com/dynamic.php?id=2&type=5
www.mysite.com/dynamic.php?id=3&type=5
www.mysite.com/dynamic.php?id=1&type=6
www.mysite.com/dynamic.php?id=2&type=6
www.mysite.com/dynamic.php?id=3&type=6
...would all be sent to:
How can this be done without doing a redirect for each ID/Type?
-
I figured it out!
RedirectMatch 301 /dynamic.php(.*) https://www.mysite.com/page.htm
-
If you're after redirecting mysite.com/page?id?=xyz to mysite.com/page the you can use RegEx in your .htaccess file to automatically does it for any variation of ID and TYPE.
I'm not particularly technical so that's all I can offer but I'd love to see what other responses you get back.
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
-
Spam pages being redirected to 404s but sill indexed
Client had a website that was hacked about a year ago. Hackers went in and added a bunch of spam landing pages for various products. This was before the site had installed an SSL certificate. After the hack, the site was purged of the hacked pages and and SLL certificate was implemented. Part of that process involved setting up a rewrite that redirects http pages to the https versions. The trouble is that the spam pages are still being indexed by Google, even months later. If I do a site: search I still see all of those spam pages come up before most of the key "real" landing pages. The thing is, the listing on the SERP are to the http versions, so they're redirecting to the https version before serving a 404. Is there any way I can fix this without removing the rewrite rule?
Technical SEO | | SearchPros1 -
.ASPX extension - individual redirects per page or....?
We have a few pages that have visible .aspx extensions. I am not as concerned with them showing as I am with the following: https://www.example.com/company.aspx - goes to Company page
Technical SEO | | MichaelEka
https://www.example.com/company - goes to homepage (should go to company page) My dev tells me that the only way to get these two pages to go to the same place would be to set up individual redirects. Is he right? That seems like it could be detrimental to SEO. Is there other code to manage this? Thanks folks.0 -
Creating a CSV file for uploading 301 redirect URL map
Hi if i'm bulk uploading 301 redirects whats needed to create a csv file? is it just a case of creating an excel spreadsheet & have the old urls in column A and new urls in column B and then just convert to csv and upload ? or do i need to put in other details or paremeters etc etc ? Cheers Dan
Technical SEO | | Dan-Lawrence0 -
Is it bad to have your pages as .php pages?
Hello everyone, Is it bad to have your website pages indexed as .php? For example, the contact page is site.com/contact.php and not /contact. Does this affect your SEO rankings in any way? Is it better to have your pages without the extension? Also, if I'm working with a news site and the urls are dynamic for every article (ie site.com/articleid=2323.) Should I change all of those dynamic urls to static? Thank You.
Technical SEO | | BruLee0 -
We have set up 301 redirects for pages from an old domain, but they aren't working and we are having duplicate content problems - Can you help?
We have several old domains. One is http://www.ccisound.com - Our "real" site is http://www.ccisolutions.com The 301 redirect from the old domain to the new domain works. However, the 301-redirects for interior pages, like: http://www.ccisolund.com/StoreFront/category/cd-duplicators do not work. This URL should redirect to http://www.ccisolutions.com/StoreFront/category/cd-duplicators but as you can see it does not. Our IT director supplied me with this code from the HT Access file in hopes that someone can help point us in the right direction and suggest how we might fix the problem: RewriteCond%{HTTP_HOST} ccisound.com$ [NC] RewriteRule^(.*)$ http://www.ccisolutions.com/$1 [R=301,L] Any ideas on why the 301 redirect isn't happening? Thanks all!
Technical SEO | | danatanseo0 -
Need Help writing 301 redirects in .htaccess file
SEOmoz tool shows me 2 errors for duplicate content pages (www.abc.com and www.abc.com/index.html). I believe, the solution to this is writing 301 redirects I need two 301 redirects 1. abc.com to www.abc.com 2. /index.html to / (which is www.abc.com/index.html to www.abc.com) The code that I currently have is ................................................... RewriteEngine On
Technical SEO | | WebsiteEditor
RewriteCond %{HTTP_HOST} ^abc.com
RewriteRule (.*) http://www.abc.com/$1 [R=301,L] Redirect 301 http://www.abc.com/index.html http://www.abc.com ...................................................... but this does not redirect /index.html to abc.com. What is wrong here? Please help.0 -
301 Single Page Redirects in IIS7?
Hey all -- I am working with a client, getting ready to make a full domain level change to a brand new domain. The existing domain has solid domain importance and trust, and the home page has a 5/10 GPR, so the transfer of all existing link juice is very important. Of course, I will be utilizing 301's to permanently redirect all existing pages to their new permanent homes. It will be a 1-1 structure, which I know is also best when possible. My question comes in specific to IIS. There is a wealth of information out there on the net regarding implementing permanent 301's using Apache and .htaccess, but nada when it comes to doing it in IIS7, which is what the client is using. For instance, today I am seeking to help them redirect 2 single pages to new destinations within the same domain, just diffferent folders. When you open up the IIS7 Control Panel (yes, with full Admin access), you can navigate to the directory, but the individual pages that I am looking to redirect with 301's do not show in IIS7, so you can't just right click on each page and choose "A redirection to a URL," etc. Any help on exactly how to redirect a single page using a permanent 301 in IIS 7 would be huge! Thanks guys!
Technical SEO | | Bandicoot0 -
IIS Work Around 301 Redirects
We are redirecting page-level content (about 500 pages) from several sub domains to our main site. With IIS, It’s my understanding that file locations must match. For example: subdomain/pathA/filename1
Technical SEO | | DigitalMkt
mainsite/pathA/filename1 Since the sub domain files are not on the main site, this means we'd create up to 500 zero byte dummy files on the new server and replicate the sub domain directory structure. With IIS is there a work around for handling page level redirects without duplicating the file location? In the case of white papers, videos and case studies, we'll imlement directory level redirection. Thanks in advance.0