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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Installing SilverStripe /

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

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

htaccess


Go to End


9 Posts   5436 Views

Avatar
chrisio

Community Member, 9 Posts

11 November 2009 at 4:40am

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

Community Member, 9 Posts

11 November 2009 at 5:21am

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

Community Member, 323 Posts

11 November 2009 at 6:32am

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

Community Member, 203 Posts

11 November 2009 at 7:46am

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

Community Member, 323 Posts

11 November 2009 at 10:29am

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

Best regards,
Juan

Avatar
bummzack

Community Member, 904 Posts

11 November 2009 at 9:49pm

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

Community Member, 1 Post

25 March 2010 at 3:27am

@banal

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

Avatar
EzraNaj

Community Member, 11 Posts

28 September 2010 at 7:54pm

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