Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Installing SilverStripe

Getting SilverStripe up and running on your computer and on your web server.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

htaccess


Go to End
Reply

9 Posts   3041 Views

Avatar
chrisio

11 November 2009 at 4:40am Community Member, 9 Posts

Hi,
I have a problem with the htaccess file conflicting with other folder within my site. My hosting allows multiple domains to be registered and pointed to subfolders within the main htdocs.

For example

Maindomain.com >> htdocs
secondarydomain.com >> htdocs/folder

and so on. What is happening is that after installtion the htaccess file is screwing with all the secondary domains and causing server 500 errors. is there a way that I can alter the htaccess file to exclude certain folders...

Heres hoping

Thanks
Chris

Avatar
chrisio

11 November 2009 at 5:21am Community Member, 9 Posts

Oop's never mind I have found the answer by searching correctly this time.
Just uploaded a htaccess file to each sub folder I dont want re-written and its all cool.

Thanks very much
Chris

Avatar
Juanitou

11 November 2009 at 6:32am Community Member, 323 Posts

Hi Chris!

I’m moving my sites to a server similar to the one you describe and I’m concerned about this subdomain thing. Could you please post the content of those .htaccess files? I’ve read that in some cases they have just to be there, even blank.

Regards,
Juan

Avatar
yurigoul

11 November 2009 at 7:46am Community Member, 202 Posts

Add this to your .htacces rules:

RewriteCond %{REQUEST_URI} !^/dirname/.*

Where dirname is the name of the folder you want to be able to access without silverstripe interfering with that.

But I think you do not need that, because the .htacces will only interfere if you are accessing yourmaindomain.com/dirname, not if you acces yoursecondarydomain.com, even though it is in a subfolder of yourmaindomain.

Avatar
Juanitou

11 November 2009 at 10:29am Community Member, 323 Posts

Thank you, it’s very kind of you. I’ll test it when I change the hosting.

Best regards,
Juan

Avatar
banal

11 November 2009 at 9:49pm Community Member, 901 Posts

This has been asked several times already.
The simplest solution (in my opinion) is to put an .htaccess into the subdomain folder (since that .htaccess file will take precedence over the one in the root folder). There you would typically turn rewriting off, or define your own rewrite rules for the subdomain. To disable rewriting, put the following in your .htaccess (for the subdomain)

<IfModule mod_rewrite.c>
RewriteEngine Off
</IfModule>

Avatar
TylerK

25 March 2010 at 3:27am Community Member, 1 Post

@banal

Thanks for that tip, just the solution I was looking for!

Avatar
EzraNaj

28 September 2010 at 7:54pm Community Member, 11 Posts

Hi
I am having a problem with rewriting urls.

I want
http://www.domainname.com/forums/member.php?u=788
to be redirected to
http://www.domainname.com/

The prob is that "?u=788" remains in the url ie it looks like this
http://www.domainname.com/?u=788

I want to have "?u=788" removed.

I tried
RewriteCond %{QUERY_STRING} .
RewriteRule ^(.*)$ /$1? [R=301,L]

but it redirects to http://www.domainname.com/sapphire/main.php

I tried
RewriteCond %{QUERY_STRING} .
RewriteRule ^(.*)$ http://%{HTTP_HOST}%{REQUEST_URI}/$1? [R=301,L]

but it still redirects to http://www.domainname.com/sapphire/main.php

I tried

RewriteCond %{QUERY_STRING} .
RewriteRule ^(.*)$ http://www.domainname.com/$1? [R=301,L]

It worked but I don't want to explicitly indicate the domain name since I'll be testing it on a dev test server and then to a staging server which means the domain names would vary.

Any ideas how to solve this?

Thanks in advance!

Go to Top