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
-
Will skipping <H> tags affect your SEO?
Will skipping <H> tags on a page have any impact on your SEO, e.g. skipping a <H2> so your page has a <H1> and then goes to a <H3>? Obviously a page must have a <H1>, but does it matter if you skip other headings?
Technical SEO | | ciehmoz0 -
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 -
Duplicate Page Titles Warnings, htaccess Rewrite & Canonical Links.
Hey guys, Just signed up for a pro account and I am getting Duplicate Page Title warnings on links that are duplicate, rewritten for SEO, but have a canonical href tag. I have two sets of links in my store: SEO friendly: http://www.mysite.com/item/iphone-case Operational link: http://www.mysite.com/shop/product.php?pid=11 This operational link however has a href canonical tag pointing to the SEO friendly link as being the primary link. My question is; Do I need to worry about this Duplicate Page Title Warning if I am using a canonical tag on the Operational link pointing to the SEO friendly link? Thanks!
Technical SEO | | jason3600 -
URL rewriting causing problems
Hi I am having problems with my URL rewriting to create seo friendly / user friendly URL's. I hope you follow me as I try to explain what is happening... Since the creation of my rewrite rule I am getting lots of errors in my SEOMOZ report and Google WMT reports due to duplicate content, titles, description etc For example for a product detail, it takes the page and instead of a URL parameter it creates a user friendly url of mydomain.com/games-playstation-vita-psp/B0054QAS However in the google index there is also the following friendly URL which is the same page - which I would like to remove domain.com/games-playstation-vita/B0054QAS The key to the rewrite on the above URLs is the /B0054QAS appended at the end - this tells the script which product to load, the details preceeding this could be in effect rubbish i.e. domain.com/a-load-of-rubbish/B0054QAS and it would still bring back the same page as above. What is the best way of resolving the duplicate URLs that are currently in the google index which is causing problems The same issue is causing a quite serious a 5XX error on one of the generated URLs http://www.mydomain.com/retailersname/1 - , if I click on the link the link does work - it takes you to the retailers site, but again it is the number appended at the end that is the key - the retailersname is just there for user friendly search reasons How can I block this or remove it from the results? Hope you are still with me and can shed some light on these issues please. Many Thanks
Technical SEO | | ocelot0 -
Mod Rewrite question to prevent duplicate content
Hi, I'm having problems with a mod rewrite issue and duplicate content On my website I have Website.com Website.com/directory Website.com/directory/Sub_directory_more_stuff_here Both #1 and #2 are the same page (I can't change this). #3 is different pages. How can I use mod rewrite to to make #2 redirect to #1 so I don't have duplicate content WHILE #3 still works?
Technical SEO | | kat20 -
What are the impact of doing URL Rewriting instead of 301 redirections whille optimizing a blog?
In WordPress, with the ALL In ONE SEO pluggingm we've optimze the permalinks to show more keewords in the URL'. What can be the impact?
Technical SEO | | webit400 -
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 -
Difference between URL Rewrites and 301 Redirects for Rankings
What is the difference between URL rewriting and 301 redirects? Specifically if my home page is rewriting the www. version and the /index.html version rather than 301 redirecting them is this equivalent? Does it still pass the link juice on those alternate variations the same way a 301 redirect will?
Technical SEO | | rcarll0