just installed v3 lite to try it out before getting full version.
i got the follwing in .htaccess file in the root folder of the .net web app
RewriteEngine On
RewriteCond %{HTTPS} (on)?
RewriteCond %{HTTP_HOST} ^zzzz-wildcard\.domain\.com
RewriteRule ^(.*)$ http://domain.com/zzzz-wildcard$1 [R]
problem is it doesn't do anything. i got the wildcard set up on iis so that
test.domain.com is served just as domain.com would be.
What i want to achieve is to serve any sub-domain user1.domain.com as domain.com/zzzz-wildcard
from what i got so far even explicity supplying zzzz-wildcard.domain.com still serves the default.aspx of the domain.com instead of domain.com/zzzz-wildcard/default.aspx
please help. i have never worked with isapi rewrite so i have no clue how to go about this.... right now as it stand it doesn't really do anything. can't say i'm good with regular expressions either :(
When opening ISAPI_Rewrite Manager and selecting my domain.com from the list of iis websites it says No properties available for this node.
******** EDIT ********
after some more looking around i found out that lite version doesn't support .htaccess so only httpd.conf file that works globally. So anyway i modified the httpd.conf file instead and it now works..
however it just redirects zzzz-wildcard.domain.com to domain.com/zzzz-wildcard
Is there a way to keep the url intact and not redirect? but still serve the pages from domain.com/zzzz-wildcard ?
finally solved after looking around other answers on stackoverflow
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\.domain\.com$ [NC]
RewriteCond %{HTTP_HOST} ^(.*?)\.domain\.com$ [NC]
RewriteRule (.*) /zzzz-wildcard/%{REQUEST_URI} [NC]
Related
I have a problem with our site after reinstalling the SSL certificate, where the www version of the site (www.mountainx.com) pulls up a completely different site. if you enter the non-www version (mountainx.com), it goes to the correct website. Some of the rules in my .HTAccess file are here - Any help would be appreciated or at least I would like to get a discussion going -
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
RewriteCond %{HTTP_HOST} ^www\.example\.com [NC]
RewriteRule ^(.*)$ http://example.com/$1 [L,R=301]
Also I have a certain number of proxy redirects that are not working either after the SSL change and I had to redirect them to the original hosts. To clarify, we use a third party to host our calendar but want to obscure the URL so it looks like we are still hosting the files. When the SSL certificate was installed, it suddenly started throwing up a 503 error so we agreed to change to the original URL hosted remotely. Also any good tutorials on .htaccess file out there? They seem to be pretty few and far between.
i have just installed my SSL wich i have bought on transip.nl
When i take a look at the website which i have installed for it looks like its not going well.
i have checked : https://www.sslshopper.com/ssl-checker.html#hostname=sloffenenpantoffels.nl
Looks fine but its not. there is no safe logo and he is still telling its an unscure connection.
When i check the URL its HTTP and not HTTPS.
Webshops is build in a magento multistore.
I have made own domain and selected his own IP for the SSL. I pointed the root folder to the folder from the main domain of the multistore.
In my htaccess file there is a rule:
RewriteCond %{HTTP_HOST} ^(.*)sloffenenpantoffels.nl
RewriteRule ^ - [E=MAGE_RUN_CODE:ditwiljehebben]
I hope that anyone can help me out here.
To force SSL just use the following:
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R,L]
I want my site to act like this. If user inputs site.cz it should be redirected to site.eu/?lang=cs but the user should still see site.cz. Right now I have the following htaccess file:
RewriteCond %{HTTP_HOST} site\.cz [NC]
RewriteCond %{REQUEST_URI} ^/$
Rewriterule ^(.*)$ http://site.eu/?lang=cs [L,R=301]
which works great and redirects only .cz request (dont do anything with .eu requests) but it displays .eu/?lang=cs in final. Problem is that I dont only want to display site.cz all the time but also links like site.eu/folder1/file1/?lang=cs should be redirected to site.cz/folder1/file1/
Any ideas how to accomplish this?
Thanks in forward
Are you using XAMPP or a web host? Upon testing, URL rewriting isn't working in XAMPP.. Anyway, you can try to check this, just make sure that your two sites are hosted by the same web hosting account:
RewriteCond %{HTTP_HOST} site\.cz [NC]
RewriteRule ^(.*)$ http://site.eu/$1?lang=cs [P,L]
But it looks like your sites aren't hosted by the same hosting account as what you've said:
when I use [P] flag I get an error "Following URL was not found on this server" – horin
What I want to achieve is to redirect any subdomain.mydomain.info to mydomain.info/subdomain using a 301 so that the visitor still sees subdomain.mydomain.info.
After some research I found that I had to set wildcard in my A-Record, did that. Than I went on to create a .htaccess. Below is my entire .htaccess.
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\.domain\.info [NC]
RewriteCond %{HTTP_HOST} ([^.]+)\.domain\.info [NC]
RewriteRule ^(.*)$ /%1/$1 [L]
When I open subdomain.mydomain.info where I know that mydomain.info/subdomain is an existing folder I only get a message telling me that the domain "subdomain.mydomain.info" is unavailable.
My webspace is running a Confixx panel, just if that helps.
What could be going wrong here?
At this point I am guessing that some configuration outside the .htacces need to be made, but no idea what and where.
BIG EDIT:
Revisiting this. Turned out I had to talk to my provider to get some things set up correctly. Still trying to figure this our though.
Current situation: the .htaccess from above gives me a 500. Putting in an R, als was suggested in the comments, will redirect "sd.domain.info" to "domain.info/sd/sd/sd/sd" and result in an error by my browser. The browser says "There is redirect on this page" and give me the option to load it again. The version suggested by Al Kafri Firas also gives me a 500. When I remove the .htaccess any "subdomain.doamin.info" gets redirected to "domain.info" with the URL being changed in the head of my browser.
Still looking to get this working....
Revert all changes you made to your A-Record and use this rules
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\.example\.info$ [NC]
RewriteCond %{HTTP_HOST} ^(www\.)?([a-z0-9-]+)\.example\.info$ [NC]
RewriteRule /%2%{REQUEST_URI} [PT,L]
I have hosting setup with a master domain (mapped to the web root) and then a number of addon domains (each with their own folder within the web root). At the moment you can visit www.masterdomain.com/addondomainsubdir and reach the same page as you would if you visited www.addondomain.com (which maps to /public_html/addondomainsubdir). I want to prevent this so if you visit www.masterdomain.com/addondomainsubdir then it will do a 301 redirect to www.addondomain.com. The new addondomain.com site is a single page site so it does not have to map any additional pages.
Adding rules to the htaccess file in the web root does notaffect anything as the subdir exists which is wierd as i thought the htaccess command should work even if there is a matching subdir (i've tried the following which works when there's no matching subdir):
RewriteRule ^addondomainsubdir?$ http://www.addondomain.com [NC,R=301,L]
Logically given it's reaching this directory I figure i need to add a command within the htaccess file in the addondomainsubdir directory however nothing appears to have any effect (i've got various other rules setup and they work fine).
I would be massively grateful if anyone explain the best way to rectify this?
Thanks so much for your help,
Dave
I know this is an old post, but it has never been successfully answered. So for all of you finding this via search, this should do what the OP is asking.
Add this line to your .htaccess file:
redirect permanent /addondomainsubdir/ http://www.addondomain.com
Try these rules in your .htaccess:
Options +FollowSymlinks -MultiViews
RewriteEngine on
# for http
RewriteCond %{HTTP_HOST} ^(www\.)?masterdomain\.com$ [NC]
RewriteCond %{SERVER_PORT} =80
RewriteRule ^([^/]+)/?$ http://www.$1.com/ [R=301,L]
# for https
RewriteCond %{HTTP_HOST} ^(www\.)?masterdomain\.com$ [NC]
RewriteCond %{SERVER_PORT} =443
RewriteRule ^([^/]+)/?$ https://www.$1.com/ [R=301,L]
Instead of putting a rule in your main .htaccess, I would make make a .htaccess for each add-on domain, putting each one in the respective subdirectory.
RewriteEngine on
RewriteCond %{HTTP_HOST} masterdomain\.com$ [NC]
RewriteRule ^addondomainsubdir(.*)$ http://www.addondomain.com/$1 [R=301,L]