Page 1 of 1

Pretty URL - subdomain gives Internal Server Error

Posted: Thu Dec 18, 2014 12:49 am
by magallo
Hi, this is a similar question to an existing thread.

I'm using the default .htaccess to run the site and all prettyurls work fine but when creating a new subdomain cn.mydomain.com i get this error:

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator and inform them of the time the error occurred, and the actions you performed just before this error.


Do you know where and how i should change settings?
Thanks

Re: Pretty URL - subdomain gives Internal Server Error

Posted: Thu Dec 18, 2014 5:30 pm
by Dr.CSS
Using pretty URLs on a subdomain is the same as using it for a subfolder site, subfolder.domain.com or domain.com/subfolder/ so you need to use the RewriteBase /subfolder part of the htaccess...

Re: Pretty URL - subdomain gives Internal Server Error

Posted: Thu Dec 18, 2014 6:39 pm
by magallo
Dr CSS, thanks for the reply.

could you be so kind to help me wrap this up?

i have mydmain.com/cn that i want to be cn.mydomain.com

Code: Select all

<IfModule mod_rewrite.c>
RewriteEngine on
#
#Sub-dir e.g: /cmsms
RewriteBase /cn
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ index.php?page=$1 [QSA]
</IfModule>
I just tried this and wasn't successful. Am i missing anything?

Re: Pretty URL - subdomain gives Internal Server Error

Posted: Thu Dec 18, 2014 8:12 pm
by velden
First of all, are you sure it has something to do with the mod_rewrite part? The default .htaccess contains more than only rewrite stuff. You could try to minimalize it to rewriting and then try again.

Dr.Css can be right but I don't think it applies to all web server configurations. If in this case the subdomain must be seen as a subdir of the root domain, it could be possible that the .htaccess from the root domain applies to subdomain too (like inheritance). Been there once and took me some time to find this was the case.

Re: Pretty URL - subdomain gives Internal Server Error

Posted: Thu Dec 18, 2014 8:49 pm
by Jo Morg
Dr.CSS wrote:Using pretty URLs on a subdomain is the same as using it for a subfolder site, subfolder.domain.com or domain.com/subfolder/ so you need to use the RewriteBase /subfolder part of the htaccess...
velden wrote:Dr.Css can be right but I don't think it applies to all web server configurations.
I beg to differ: RewriteBase is used in the URL context when the site is in a folder relative to the domain root, i.e. given a domain (or sub-domain) like:
- domain.com;
- www.domain.com (note that www is already a sub-domain of domain.com);
- www.sub.domain.com;

in neither of these cases you need anything more than RewriteBase /.

However in:
- domain.com/folder;
- www.domain.com/folder;
- www.sub.domain.com/folder;

you need RewriteBase /folder.

Further, you can even have these:
- domain.com/folder/subfolder;
- www.domain.com/folder/subfolder;
- www.sub.domain.com/folder/subfolder;

in which case you need RewriteBase /folder/subfolder.

That has been my experience so far and my interpretation of
http://httpd.apache.org/docs/current/mo ... ewritebase
velden wrote:First of all, are you sure it has something to do with the mod_rewrite part? The default .htaccess contains more than only rewrite stuff. You could try to minimalize it to rewriting and then try again.
Additionally check if the site works without mod_rewrite at all or with internal pretty_urls. You need (as velden stated) to debug a bit further. Otherwise we can only guess about the possible causes to your problem.