Htaccess mod rewrite from server address
-
Hi there,
I'm not massively experienced with creating mod rewrite rules and I'm worried I've got this wrong as its slightly different to what I'm used to.
The web dev and content creators were working on http://5.10.105.45/~isea/ to create content.
I want to redirect all URL's to www.iseasurfwear.co.uk. This is what I've written
//Rewrite to www
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^5.10.105.45/~isea/[nc]
RewriteRule ^(.*)$ http://www.iseasurfwear.co.uk/$1 [r=301,nc]Can anyone tell me if this is correct?
-
Try
RewriteEngine On
RewriteCond %{HTTP_HOST} ^5.10.105.45/~isea/
RewriteRule ^(.*)$ http://www.NewDomain.com/$1 [R=301,L]Or
RewriteEngine On
RewriteCond %{HTTP_HOST} /~isea/$
RewriteRule ^(.*)$ http://www.NewDomain.com/$1 [R=301,L]** (edit) Make sure your sever has Mod Rewrite Enabled*
-
Agreed, but for now I just want to cover the issue so we can move forward. Slight update to my code. This rewrites the homepage, but doesn't seem to be rewriting anything else. Any tips?
Options +FollowSymlinks
RewriteEngine on
rewritecond %{http_host} ^5.10.105.45/~isea/ [nc]
rewriterule ^(.*)$ http://www.mydomain.com/$1 [r=301,nc] -
If you're moving from a dev environment to live, it's not redirects that you need. You need to update the references in the code of the template and in the content areas that your developers didn't clean up when moving the site to live. Doing rewrites will only cover the issue, but the incorrect links will still be there.
-
Just tested. It doesn't work. Any help?
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
-
Rel Canonical, Follow/No Follow in htaccess?
Very quick question, are rel canonical, follow/no follow tags, etc. written in the htaccess file?
Technical SEO | | moon-boots0 -
Two Dentists, Same Address, Same Phone, Different Business Names
Hi Everyone, I've been looking into this situation for quite a while, but most posts/information on this topic seem to be from at least 1-2 years ago. I'm currently working with a dentist who just moved into the same suite as another dentist who has been working there for years. They each have the same address and same suite number, the same phone number, but each own their own respective practice and have their own patients. To make things even more complicated, the dentist that has been working there for years uses his name as a business name, while the new dentist has a business name differing from her actual name. I'm not exactly sure how to go about optimizing the new dentist's local presence, but the only thing I can think of doing is try to recommend having the suite split into Suite #-A and Suite #-B and seeing if it's possible to add a second phone number for the new dentist. Please let me know your thoughts, and if you've seen this topic come up in the past, I would love to get pointed in the right direction. Thanks for all your help!
Technical SEO | | abnovak1 -
Can anyone speak to the pros and cons of installing mod_expire on an Apache server?
We recently had mod_deflate and mod_expire installed on our server in an attempt to improve pagespeed. They worked beautifully, at least we thought they did. Google's pagespeed insights tools evaluated our homepage at 65 before the install and 90 after...major improvement. However, we seem to be experiencing very slow load on our product pages. There is a feeling (not based on any quantifiable data) that mod_expire is actually slowing down our page load, particularly for visitors who do not have the page cached (which would probably be most visitors). Here are some pages to look at with their corresponding score from the Pagespeed Insights tool: Live Sound - 91 http://www.ccisolutions.com/StoreFront/category/live-sound-live-audioWireless Microphones - 90 http://www.ccisolutions.com/StoreFront/category/microphones Truss and Rigging - 79 http://www.ccisolutions.com/StoreFront/category/lighting-truss light weight product detail page 83 http://www.ccisolutions.com/StoreFront/product/global-truss-sq-4109-12-truss-segment heavy weight product detail page 77 http://www.ccisolutions.com/StoreFront/product/presonus-studiolive-16-4-2 Any thoughts from my fellow Mozzers would be greatly appreciated!
Technical SEO | | danatanseo1 -
Wordpress Redirect Plugin Vs Manual .htaccess?
Hi everyone, I need to 301 redirect my old pages to new ones but i am confused between whether to choose plugin for this or i should manually rewrite the code on .htaccess file. Please give your suggestion and if you think i should use plugin then which one?
Technical SEO | | himanshu3019890 -
My .htaccess has changed, what do i do to avoid it again...?
Hello Today i notice that our site did not auto changed from without www to with, when i checked the .htaccess file i notice # in-front of each line and i know we did not insert it in there, after i removed it it worked fine. The only changes that we did recently was to a mobile version to the site but the call to autodirect is in a JS and not in the .htaccess, could it be the server..? is there any way that anything else might cause this...? The site is HTML and WP could it be because of that...? Thank's Simo
Technical SEO | | Yonnir0 -
Help needed please with 301 redirects in htaccess file.
In summary, we're currently having issues with our htaccess file. 301 redirects are going through to the new described URL but in addition the new URL is followed by a ? and the old URL. How can we get rid of the ? and previous URL so they don't appear as an ending. None of the examples we've found re this issue online appear to work. Can anyone please offer some advice? Can we use a RewriteRule to stop this happening? Here's a summary of the htaccess file REDIRECT CODE BEGINS HERE LONG LIST OF REDIRECTS, which appear to be set up perfectly fine. REDIRECT CODE ENDS DirectoryIndex index.php <ifmodule mod_rewrite.c="">RewriteEngine On Options +FollowSymLinks
Technical SEO | | petersommertravels
DirectoryIndex index.php
RewriteEngine On
RewriteCond $1 !^(images|system|themes|pdf|favicon.ico|robots.txt|index.php) [NC]
RewriteRule ^.htaccess$ - [F]
RewriteRule ^favicon.ico - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?/$1 [L]</ifmodule> DirectoryIndex index.php0 -
Multiple Domains on 1 IP Address
We have multiple domains on the same C Block IP Address. Our main site is an eCommerce site, and we have separate domains for each of the following: our company blog (and other niche blogs), forum site, articles site and corporate site. They are all on the same server and hosted by the same web-hosting company. They all have unique and different content. Speaking strictly from a technical standpoint, could this be hurting us? Can you please make a recommendation for the best practices when it comes to multiple domains like these and having separate or the same IP Addresses? Thank you!
Technical SEO | | Motivators0 -
How Best to Handle 'Site Jacking' (Unauthorized Use of Someone else's Dedicated IP Address)
Anyone can point their domain to any IP address they want. I've found at least two domains (same owner) with two totally unrelated domains (to each other and to us) that are currently pointing their domains to our IP address. The IP address is on our dedicated server (we control the entire physical server) and is exclusive to only that one domain (so it isn't a virtual hosting misconfiguration issue) This has caused Google to index their two domains with duplicate content from our site (found by searching for site:www.theirdomain.com) Their site does not come up in the first 50 results though for any of the keywords we come up for so Google obviously knows THEY are the dupe content, not us (our site has been around for 12 years - much longer than them.) Their registration is private and we have not been able to contact these people. I'm not sure if this is just a mistake on the DNS for the two domains or it is someone doing this intentionally to try to harm our ranking. It has been going on for a while, so it is most likely not a mistake for two live sites as they would have noticed long ago they were pointing to the wrong IP. I can think of a variety of actions to take but I can find no information anywhere regarding what Google officially recommends doing in this situation, assuming you can't get a response. Here's my ideas. a) Approach it as a Digital Copyright Violation and go through the lengthy process of having their site taken down. Pro: Eliminates the issue. Con: Sort of a pain and we could be leaving possibly some link juice on the table? b) Modify .htaccess to do a 301 redirect from any URL not using our domain, to our domain. This means Google is going to see several domains all pointing to the same IP and all except our domain, 301 redirecting to our domain. Not sure if THAT will harm (or help) us? Would we not receive link juice then from any site out there that was linking to these other domains? Con: Google will see the context of the backlinks and their link text will not be related at all to our site. In addition, if any of these other domains pointing to our IP have backlinks from 'bad neighborhoods' I assume it could hurt us? c) Modify .htaccess to do a 404 File Not Found or 403 forbidden error? I posted in other forums and have gotten suggestions that are all over the map. In many cases the posters don't even understand what I'm talking about - thinking they are just normal backlinks. Argh! So I'm taking this to "The Experts" on SEOMoz.
Technical SEO | | jcrist1