Forum Moderators: phranque
Example.com/subdomain/folder/file.php also resolves OK.
I have tried rewriting the URL from subdomain.example.com to example.com/subdomain/
ie,
Options +FollowSymlinks
RewriteEngine On
RewriteCond %{http_host} ^subdomain.example.comt(.*) [NC]
RewriteRule ^(.*)$ http://example.com/subdomain/$1 [R=301,L]
I have downloaded/tried various other forms of subdomain redirect unsuccessfully too.
Any ideas please?
I have tried rewriting the URL...
No. You have redirected requests for one URL, such that the browser is advised to make a new request for a new URL. Rules with either a domain name in the target and/or the [R] flag are redirects.
The stuff in bold is NOT required:
^subdomain\.example\.com[b]t(.*)[/b] Since it it usually desired to use an internal rewrite to 'map' subdomain requests to a subdirectory, here' one way to fix it:
Options +FollowSymlinks
RewriteEngine on
#
RewriteCond %{HTTP_HOST} ^subdomain\.example\.com [NC]
RewriteCond $1 !^subdomain/
RewriteRule ^(.*)$ /subdomain/$1 [L]
Note: When you get a 500-Server Error, the first place to look is in your server error log file. The information in that file often indicates the exact problem, or at least gives a strong clue... In this case, you will find "Request exceeded the limit of <number> redirects due to probable configuration error." or some-such, pointing you to an error in your configurations files -- e.g. .htaccess code.
Jim
Also, be aware that in that type of set-up, it's common for the host to flush the error the log file, usually on a daily basis. So you might have to re-create the errors to see a 'fresh' error log entry.
Jim