How to skip all rewrite rules
-
My web host account allows me to have multiple domain names. Internally, the first domain is the main domain, and the additional domains are virtual domains, but externally, the intent is for each domain to appear as a unique domain. When accessing a virtual domain, the server first processes the main .htaccess file, and then processes the .htaccess file for that virtual domain. I'm sure this is a common setup, and this is not unique to my web host.
Due the main .htaccess file, references to virtual.com are rewritten as main.com/virtual. The web pages are displayed correctly, but of course, this rewrite is not what is desired. What is the common solution? For example, is there a conditional rewrite rule that says ignore the rest of the rewrite rules in this .htacces file?
Best,
Christopher -
Thanks for the quick response. Yes, I have access to edit the .htaccess file.
I'll try using the [L] tag for the virtual domains.
Best,
Christopher -
Do you have access to edit the .htaccess file? If so I can see two possible solutions:
1. There could be a wildcard in the .htaccess regex, meaning 'take all domains and then redirect to domain/virtual'. If you could change it to specifically process just your main domain, and not wildcard everything coming in that might work.
2. .htaccess entries are executed in the order they're written, so if you have more specific directives you could put those 'above' whatever is handling the rewrites you're having a problem with. If you use the [L] tag I believe that tells the rule 'okay, stop processing after this one'.
WARNING: If you don't understand it, messing with the .htaccess can mess things up! Especially if you change domain rules and then use the 'L' flag to exit processing, and then it skips directory/file rules further on down!
Also, here's a StackOverflow article about conditional .htaccess rules:
http://stackoverflow.com/questions/1035953/how-can-i-make-my-htaccess-skip-rules-conditionally
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
-
Rewrite a good post
Hello I have a blog post from 2015 that is ranking very well on Google but I have a terrible bounce rate of more than 98% for this landing page. This post is bringing 4 more visits than the rest of my website pages so I need to make people stay in the site. I don't want to lose my rankings so my question is: Is it better to modify this post or to write a new post and delete the old one? Thank you
Technical SEO | | seoandromedical0 -
Lowercase Rewrite in web.config. Strange behavior.
So I am trying to implement a lower case rule in my rewrite section and I am using the same snippet below that can be found all over the web. The lower casing of my url works fine but it adds my domain name into the URL for reasons I can't explain. so this www.SomeSite.com/Upper.aspx become www.somesite.com/somesite/upper.aspx I removed all other rewrite rules but this one and still it happens. Has anyone seen this? My server is IIS 7 <match url="[A-Z]" ignorecase="false"></match> <action type="Redirect" url="{ToLower:{URL}}"></action>
Technical SEO | | Banknotes0 -
Problem www/non-www domain rewrite
Hello, I've made a site for a client about 1 year ago. The rankings are quite okay, but the home page suffers from a penalty I think. I found out via OSE that PageAuthority strangely is higher on the 301-ed page www.myanmar-rundreisen.de - PA 32
Technical SEO | | hgw57
myanmar-rundreisen.de/ - PA 33 I don't understand what is happening here as I am using the usual htaccess 301-redirect: Rewrite domain.com -> www.domain.com RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST} !^www.myanmar-rundreisen.de [NC]
RewriteRule (.*) http://www.myanmar-rundreisen.de/$1 [L,R=301] which is working fine with other domains ... I tried also (last line) RewriteRule (.*) http://www.myanmar-rundreisen.de/$1 [L,R=301] So thanks to anyone who can share an idea on that ... Guenter K04xy.jpg0 -
Need Help with MAGENTO - URL rewrite
Hello... Hopefully a Magento expert will stumble across this question and help me out. I have noticed that my site is no longer as prominent as it once was for specific product pages... I am looking for help in rewriting the URL's for the product pages. I want it to have xyz.com/product (which exists if you hard code it into the site) If you wind up on the product by clicking throught the categories the url looks like: xyz.com/category/subcategory/product. Does anyone know how to make it so when you land on a product page it is just xyz.com/product ? My Site is : http://goo.gl/JgK1e Thanks for the help...
Technical SEO | | Prime850 -
How to properly abandon mod rewrite?
Hi, We've done mod-rewrite to our .php files to show .htm files several years ago for SEO purposes. My question is, doing this has become a hassle for adding new pages, etc. and I'd like to make a clean break with the .htm and move to their real file names and or directories (e.g. company.htm --> /company/ ). What kind of ranking penalty am I looking at if we switch? We're a small company with billion dollar competitors so a rank loss would be fairly devastating. I assume I'd need to do 301 redirects for all of the old file names (obviously yes for the change from page to directories) but for each individual page? Thanks, Matt
Technical SEO | | mynewco0 -
When creating articles what are the rules of thumb for titles and url links.
For example lets say I'm looking to rank for “Window Glass Replacement”. What kinds of articles should I create for this? Does it matter? Should I create articles such as How to know if your windows need replacement, then have the text in my link say “Window Glass Replacement.” Should I try and vary the link name? Should I vary the titles of my articles, or just make sure the content is different?
Technical SEO | | marker-3115280 -
Sharepoint SEO - How to lowercase urls with rewrite rules?
We have a borked website running on sharepoint IIS .net that has been at the mercy of many bad developers We have rewrite rules with an ini file for 301s etc. We are struggling to find out or figure out how to lowercase them The lowercase functionality may be native within sharepoint somewhere Any help appreciated! Sorry its so vague S
Technical SEO | | firstconversion0 -
When URL rewrite can lead to un pretty URLs
Hi Mozzers. I've a client that has done a little bit of mess rewriting the URLs of its site. In fact, also the data base driven URLs are rewritten, but the dev forgot to change the space with "-", so that now the 95% of the URLs are like this one: http://www.portalesardegna.com/search/Appartamenti e Residence/ Obviously not really a pretty URL. I am not so sure if this issue has an SEO consecuences (in fact, the site ranks pretty well also with those kind of url), but I am thinking more on usability issue. Could you suggest me any easy fix to this rewrite problem?
Technical SEO | | gfiorelli12