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 -
When to use mod rewrite / canonical / 301 redirect
Hello, I have taken over the management of a site which has a big problem with duplicate content. The duplicate content is caused by two things: Upper and lower case urls e.g: www.mysite.com/blog and www.mysite.com/Blog The other reason is the use of product filters / pagination which mean you can get to the same 'page' via different filters. The filters generate separate URLs. http://www.mysite.com/casestudy
Technical SEO | | Barques-Design
http://www.mysite.com/casestudy/filter?page=1
http://www.mysite.com/casestudy/filter?solution=0&page=1
http://www.mysite.com/casestudy?page=1
http://www.cpio.co.uk/casestudy/filter?solution=0" Am I right to assume that for the case sensitive URLs I should use a 301 redirect because I only want the lower page to be shown? For the issue with dynamic URLs should we implement a mod-rewrite and 301 to one page? Any advice would be greatly appreciated.
Mat0 -
What's the rules on overly dynamic URLs ?
Developer says "Overly-Dynamic URL. Developer says that this is the hardest and complex part. It will be possible to change all of the search criterias to use ( / )
Technical SEO | | stewbuch1872
But in this case each of the pages will be indexed and every time listing gets added, content will get changed. Which for example Google will start blocking what is the best way to address this and will google block as suggested ? thanks0 -
Question for experts - a website is ranking defying all google rules
Hi all Today I saw a strange result in google's search page. When I typed a keyword: Rezeptfrei bestellen, it gave me results like number 1- http://www.rezeptfreibestellen.com/ If I check this site in opensiteexplorer, this is nothing but a new site with no backlinks, or any other offpage work. Onpage work is simply keyword stuffing and domain name is also same as keyword. Now why google ranked this website above others? Where are google EMD and Penguin, Panda? Amit
Technical SEO | | expertvillagemedia1 -
Htaccess rewrites
We’re using wordpress, and we have the following in the .htaccess: BEGIN WordPress RewriteEngine On RewriteBase / RewriteRule ^index.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] END WordPress We have a URL like http://subdomain.example.com/select-a-card/?q=fuel, and I want to rewrite it so that it becomes http://subdomain.example.com/fuel-card/ What do I need to add to the htaccess to do this?? Thanks,
Technical SEO | | AndrewAkesson0 -
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 -
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 -
URL Rewrite
We are trying to convince a client to do a massive rewrite from all URL's looking like this: "www.company.com/category/categoryId=82374" to something like "www.company.com/womens/jackets/rain" How would you describe the importance and impact of doing URL rewrites to an ecommerce site? What evidence/research can we share with them to convince them it is worth the time and effort to do?
Technical SEO | | Hakkasan0