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
-
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
Technical SEO | | BlueTree_Sean
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?0 -
Url rewrite subfolder
Hi, How can i rewrite example.com/example1/example2/example3 to example.com/example3 And is there tools or software that can generate url rewrite... (not a plugin) Thanks !
Technical SEO | | bigrat950 -
High DA url rewrite to your url...would it increase the Ranking of a website?
Hi, my client use a recruiting management tool called njoyn.com. The url of his site look like: www.example.njoyn.com. Would it increase his ranking if I use this Url above that point to njoyn domain wich has a high DA, and rewrite it to his site www.example.com? If yes how? Thanks
Technical SEO | | bigrat950 -
Is it necessary to 301 rewrite /index.php to /?
Hi, We have build a lot of external link to http://www.oursite.com/ Do I have to do a 301 redirect from http://www.oursite.com/index.php to http://www.outsite.com/? Thanks
Technical SEO | | LauraHT0 -
Skip indexing the search pages
Hi, I want all such search pages skipped from indexing www.somesite.com/search/node/ So i have this in robots.txt (Disallow: /search/) Now any posts that start with search are being blocked and in Google i see this message A description for this result is not available because of this site's robots.txt – learn more. How can i handle this and also how can i find all URL's that Google is blocking from showing Thanks
Technical SEO | | mtthompsons0 -
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 -
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 -
Rel=Canonical to Rewrite or original URL?
Working with a large number of duplicate pages due to different views of products. Rewriting URLs for the most linked page. Should rel=canonical point to the rewritten URL or the actual URL? Is there a way to see what the rewritten URL is within the crawl data? I was taking the approach of rewriting only the base version of each page and then using a rel=canonical on the duplicate pages. Can anyone recommend a better or cleaner approach? Haven't seen too many articles on retail SEO when faced with a less than optimized CMS. Thanks!
Technical SEO | | AmsiveDigital0