301: Dynamic URL to Static Page
-
I've been going around trying to get this dynamic url to redirect in the .htaccess file. I know I'm missing something but can't figure it out.
Code:
RewriteEngine on
RewriteCond %{QUERY_STRING} ^/dynamic-url.php?id=43$
RewriteRule ^$ http://static/page/url/inserted/here? [R=301,L]Suggestions?
-
Hi there,
If it's only that URL (not a group of URLs with a pattern to follow) that you need to 301-redirect then you can directly use:
RedirectMatch 301 /dynamic-url.php?id=43 http://www.yourdomain.com/static/page/url/inserted/here
If this is not the situation please let me know!
Thanks,
Aleyda
-
In that case try my rewrite, like this and escape your metacharacters like . / - etc..
RewriteEngine on
RewriteCond %{HTTP_HOST} ^domain.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.domain.com$
RewriteRule ^dynamic-url.php?id=43$ "http://static/page/url/inserted/here" [R=301,L]edited that I forgot to escape the - and . in dynamic-url.php
-
It is the first one unfortunately it doesn't seem to be working for me.
-
Ahh yes I know what you mean that way. I meant programatically. Are you going to go through all the urls and manually assign them a redirect or are you trying to do one rewrite for multiple urls?
If the first one you could just use the example I gave you and modify it.
Also only just noticed I see you haven't escaped your metacharacters. This an example from mine (not using dynamic urls):
RewriteCond %{HTTP_HOST} ^domain.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.domain.com$
RewriteRule ^Old-Page.html$ "http://www.domain.com/New-Page.html" [R=301,L] -
I'm trying to take a dynamic url and redirect (301) it to a static url
dynamic: /dynamic-url.php?id=43
-
No sure exactly what you are trying to do...
this is something similar does it help? (from Stack Overflow)
RewriteCond %{QUERY_STRING} ^route=product/category&path=35&page=([0-9]+)$
RewriteRule ^index.php$ /product/category/35/page_%1? [R=301,L]Adam
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
-
Purpose of static index.html pages?
Hi All, I am fairly new to the technical side of SEO and was hoping y'all could help me better understand the purpose of dynamic rendering with index.html pages and any implications they might hold for SEO. I work to support an eComm site that includes a subdomain for its product pages: products.examplesite.com. I recently learned from one of our developers that there are actually two sets of product pages - a set of pages that he terms "reactive," that are present on our site, that only display content when a user clicks through to them and are not retrievable by search engines. And then a second set of static pages that were created just for search engines and end in .index.html. So, for example: https://products.examplesite.com/product-1/ AND https://products.examplesite.com/product-1/index.html I am confused as to what specifically the index.html pages are doing to support indexation, as they do not show up in Google Site searches, but the regular pages do. Is there something obvious I am missing here?
Technical SEO | | Lauren_Brick0 -
Thousands of 404-pages, duplicate content pages, temporary redirect
Hi, i take over the SEO of a quite large e-commerce-site. After checking crawl issues, there seems to be +3000 4xx client errors, +3000 duplicate content issues and +35000 temporary redirects. I'm quite desperate regarding these results. What would be the most effective way to handle that. It's a magento shop. I'm grateful for any kind of help! Thx,
Technical SEO | | posthumus
boris0 -
Is 301 redirect replacing or adding PA on a page ?
Hello Moz community, I am re-structuring information architecture on a website. The homepage targets keyword A
Technical SEO | | Sindicic_Alexis
There is a page /page-on-B/ that targets keyword B
There is also an older page /page-on-kinda-B/ that targets a keyword which is really close to B ( i think they should have been worked on the same page...) I want to re-optimise the homepage on keyword B because i know it is worth the effort. If i re-write the homepage to talk about B and do a 301 redirect of : /page-on-B/
/page-on-kinda-B/ to the homepage is it going to add page authority to the homepage ? is it the right way to proceed ?
Thanks for your support !0 -
When we have 301 page is a Rel=Canonical needed or should we make 1 Noindex?
Hi, When we have a page as 301 (Permanent Redirect) is a Rel=Canonical needed or should we make 1 Noindex? Example http://www.Somename.com/blog/138760 when clicked goes to http://www.Somename.com/blogs/whenittyam Should i noindex the below pages http://www.Somename.com/blog/138760 and add Rel=Canonical Thanks
Technical SEO | | mtthompsons0 -
How do I fix issue regarding near duplicate pages on website associated to city OR local pages?
I am working on one e-commerce website where we have added 300+ pages to target different local cities in USA. We have added quite different paragraphs on 100+ pages to remove internal duplicate issue and save our website from Panda penalty. You can visit following page to know more about it. And, We have added unique paragraphs on few pages. But, I have big concerns with other elements which are available on page like Banner Gallery, Front Banner, Tool and few other attributes which are commonly available on each pages exclude 4 to 5 sentence paragraph. I have compiled one XML sitemap with all local pages and submitted to Google webmaster tools since 1st June 2013. But, I can see only 1 indexed page by Google on Google webmaster tools. http://www.bannerbuzz.com/local http://www.bannerbuzz.com/local/US/Alabama/Vinyl-Banners http://www.bannerbuzz.com/local/MO/Kansas-City/Vinyl-Banners and so on... Can anyone suggest me best solution for it?
Technical SEO | | CommercePundit0 -
Splitting Page Authority with two URLs for the same page.
Hello guys, My website is currently holding two different URLs for the same page and I am under the impression such set up is dividing my Page Authority and Link Juice. We currently have the following page with both URLs below: www.wbresearch.com/soldiertechnologyusa/home.aspx
Technical SEO | | JoaoPdaCosta-WBR
www.wbresearch.com/soldiertechnologyusa/ Analysing the page authority and backlinks I identified that we are splitting the amount of backlinks (links from sites, social media and therefore authority). "/home.aspx"
PA: 67
Linking Root Domains: 52
Total Links: 272 "/"
PA: 64
Linking Root Domains: 29
Total Links: 128 I am under the impression that if the URLs were the same we would maximise our backlinks and therefore page authority. My Question: How can I fix this? Should I have a 301 redirect from the page "/" to the "/home.aspx" therefore passing the authority and link juice of “/” directly to “/homes.aspx”? Trying to gather thoughts and ideas on this, suggestions are much appreciated? Thanks!0 -
Has Google stopped rendering author snippets on SERP pages if the author's G+ page is not actively updated?
Working with a site that has multiple authors and author microformat enabled. The image is rendering for some authors on SERP page and not for others. Difference seems to be having an updated G+ page and not having a constantly updating G+ page. any thoughts?
Technical SEO | | irvingw0 -
Determining When to Break a Page Into Multiple Pages?
Suppose you have a page on your site that is a couple thousand words long. How would you determine when to split the page into two and are there any SEO advantages to doing this like being more focused on a specific topic. I noticed the Beginner's Guide to SEO is split into several pages, although it would concentrate the link juice if it was all on one page. Suppose you have a lot of comments. Is it better to move comments to a second page at a certain point? Sometimes the comments are not super focused on the topic of the page compared to the main text.
Technical SEO | | ProjectLabs1