Menu Content

Support

> Forums, FAQs & Paid Support
Welcome, Guest
Username Password: Remember me

Internal Server Error on 404 for subdomains
(1 viewing) (1) Guest
SEO component and search engine friendly URLs manager for Joomla!

If your topic falls within one of the subcategories, then please post it directly there. Post to this parent category only if your question does not match any subcategory topic.
  • Page:
  • 1

TOPIC: Internal Server Error on 404 for subdomains

Internal Server Error on 404 for subdomains 14 years, 9 months ago #10570

I have a main domain with several subdomains. The main domain is a Joomla site, but the main domains are not, they are individual artist's sites, some with their own domain name, but others that use subdomains ( ie. artist.maindomain.com)

I recently set up JoomSEF (for my main domain Joomla site) and I just noticed that instead of getting my normal 404 error page on the subdomains, I am getting Internal Server Errors. I contacted my host support and they said, in essence, that because the subdomains don't use the Joomla index.php file, the "redirect runs in a loop causing you to go over the limit of internal redirects and never complete".

I went into the JoomSEF configuration to see if there was something I could do and noticed that I should include RewriteBase / in my .htacess file, so I did that. and now, in the subdomains, I am not getting the Internal Server Error, but I am also not getting a Not Found error, it simply goes to the Home Page for that subdomain. Some of these subdomains have custom 404 error files and others don't, but the same thing happens either way, on a 404 error it just goes to the home page.

I'm not very good at mod_rewrite, but I suspect there might be something that could be done in the .htaccess file. Can anyone help? CAn the .htaccess files be modified to solve this problem?

The subdomains have very simple .htaccess files usually similar to:
 
DirectoryIndex index.html index.php index.htm
IndexIgnore *
#Not all have the following
ErrorDocument 404 /errors/404.html
 


Here is part of my main domain .htacess file:

 
IndexIgnore *
Options +FollowSymLinks
#
Order deny,allow
#
<Limit PUT DELETE>
Deny from all
</Limit>
 
#JoomSef is not using this 404.php file
ErrorDocument 404 /errors/404.php
ErrorDocument 401 /errors/401.php
ErrorDocument 500 /errors/500.php
#
#
RewriteEngine on
RewriteBase /
#
# Rewrite old urls to go to new subdomains or domains
RewriteRule ^artist1(.*) http://www.artist1.com$1 [R=301,L]
RewriteRule ^artist2(.*) http://artist2.mydomain.com$1 [R=301,L]
RewriteRule ^artist3(.*) http://artist3.mydomain.com$1 [R=301,L]
 
########## Begin - Joomla! core SEF Section
#
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/index.php
RewriteCond %{REQUEST_URI} (/|\.php|\.html|\.htm|\.feed|\.pdf|\.raw|/[^.]*)$ [NC]
RewriteRule (.*) index.php
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
#
########## End - Joomla! core SEF Section
 
The topic has been locked.

Re:Internal Server Error on 404 for subdomains 14 years, 9 months ago #10571

I found a fix:

I moved the core SEF section to the bottom of the file and added two lines to specify this only is for the main domain. I'm still having a few problems, bu this cleared up the one I was asking about. :-)

 
########## Begin - Joomla! core SEF Section
#
RewriteCond %{HTTP_HOST} ^(www.)?\example\.com [NC]
# and is NOT *exactly* *precisely* "www.example..."
RewriteCond %{HTTP_HOST} !=www.example.com
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/index.php
RewriteCond %{REQUEST_URI} (/|\.php|\.html|\.htm|\.feed|\.pdf|\.raw|/[^.]*)$ [NC]
RewriteRule (.*) index.php
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
#
########## End - Joomla! core SEF Section
 
The topic has been locked.

Re:Internal Server Error on 404 for subdomains 14 years, 9 months ago #10572

Well, that didn't work. Now, none of the JoomSEF links work!

Can someone help me with the correct syntax? I seem to be on the right track, but not quite there.

Thank You!
The topic has been locked.

Re:Internal Server Error on 404 for subdomains 14 years, 9 months ago #10719

  • jaku
Hello,

I am not sure what you are trying to achieve with line
RewriteCond %{HTTP_HOST} !=www.example.com 

Are you sure about that one? Also, I would recommend using just 1 form of main URL. (either www.mydomain.com or just maindomain.com). The other should be redirected to the main one using R=301.
The topic has been locked.

Re:Internal Server Error on 404 for subdomains 14 years, 9 months ago #10727

Hi,

I got it figured out. My syntax in that line had errors. The correct syntax is:
RewriteCond %{HTTP_HOST} ^(www\.)?example\.com [NC]

The problem was that the directives in the Joomla! core SEF Section, were not only applying to my Joomla site (my main site), but to every other site in subdirectories under my main site. These were not Joomla sites, so I needed to write some code to restrict the code to only the main site - example.com.

An Apache expert also helped me rewrite the rest of the SEF section to optimize it so it would run faster. I don't know if he is a Joomla expert. But the code does work and is now doing what I needed.

 
########## Begin - Joomla! core SEF Section

RewriteCond %{HTTP_HOST} ^(www\.)?example\.com [NC]
RewriteCond %{REQUEST_URI} (\.php|\.html?|\.feed|\.pdf|\.raw|/[^.]*)$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) index.php
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
#
########## End - Joomla! core SEF Section
 


NOTE: I do have code earlier in my .htaccess file that rewrites urls to add the www. if missing. So even though this code will accept either here, the url would already have been written to include the www.

Thanks for your input! It reminded me I needed to put the solution up. :-)
The topic has been locked.
  • Page:
  • 1
User Login Empty