php - htaccess subdomain with subfolders access -


i trying rewrite subdomain request subfolder in server using .htaccess. want mail.domain.com mail folder located in root. able achieve below code

rewriteengine on rewritecond %{http_host} mail.domain.com$ rewritecond %{request_uri} !^/mail rewriterule ^(.*)$ /mail/$1 [l] 

this works correctly. when browse mail.domain.com getting contents of domain.com/mail/index.php.

however doesn't work subfolders inside subdomain. ie when browse mail.domain.com/installer doesn't give contents domain.com/mail/installer/index.php. instead shows 404 error. tried code htaccess subdomain pointing . somehow unable output. method gives same problem. doing wrong?

note:

  1. i not want redirect conditions. want achieve via rewrite rules.
  2. i using openshift server. created domain.com & mail.domain.com aliases.
  3. root folder contains wordpress no below .htaccess rules.

edit

<ifmodule mod_rewrite.c> rewriteengine on rewritebase / rewriterule ^index\.php$ - [l] rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule . /index.php [l] </ifmodule> 

when remove above wordpress htaccess works well. causing 404 error in subdomain subfolders. please can both wordpress pretty urls , subdomain subfolders work?

note: sorry. wordpress added via web interface , failed notice that.

keep root .htaccess this:

rewriteengine on rewritebase /  rewritecond %{http_host} =mail.domain.com rewriterule ^((?!mail).*)$ mail/$1 [l,nc]  rewriterule ^(index\.php$|mail) - [l,nc]  rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule . index.php [l] 

Comments

Popular posts from this blog

qt - Using float or double for own QML classes -

Create Outlook appointment via C# .Net -

ios - Swift Array Resetting Itself -