質問

I have added a subdomain for my website - lets says

man.domain.com

This was the original content - was added to redirect domain.com to www.domain.com

<VirtualHost xx.yy.zz.abc:80>
   DocumentRoot "/home/webadmin/domain.com/html"
   ServerName domain.com
   ServerAlias www.domain.com
   RewriteEngine on
   RewriteCond %{HTTP_HOST} ^domain.com [NC]
   RewriteRule ^(.*)$ http://www.domain.com/$1 [L,R=301]
</VirtualHost>

Now in my httpd.conf - I have added the following for subdomain

<VirtualHost xx.yy.zz.abc:80>
   DocumentRoot "/home/webadmin/domain.com/html"
   ServerName domain.com
   ServerAlias man.domain.com   
   RewriteEngine on
   RewriteCond %{HTTP_HOST} ^domain.com [NC]
   RewriteRule ^(.*)$ http://man.domain.com/$1 [L,R=301]
</VirtualHost>

So now when I access the home page

http://man.domain.com

It works fine and the page opens up - but when I click on subsequent links in the home page - they dont work - like

http://man.domain.com/user/abc

This results in

Not Found
The requested URL /user/abc was not found on this server.
Apache/2.2.21 (CentOS) Server at man.domain.com Port 80

This is what I have in my .htaccess file - havent changed this - this is what I had even before adding subdomain

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ /index.php [NC,L]
RewriteCond %{REQUEST_URI} ^(.*)//(.*)$
RewriteRule . %1/%2 [R=301,L]

So I'm not sure if this is any Zend setting I need to configure or apache

Any help will be appreciated Thanks

役に立ちましたか?

解決

Hi please try this one should do it for Zend Framework:

<VirtualHost xx.yy.zz.abc:80>
ServerName domain.com
ServerAlias man.domain.com  
DocumentRoot "/home/webadmin/domain.com/html"

RewriteEngine off

<Location />
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} -s [OR]
    RewriteCond %{REQUEST_FILENAME} -l [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^.*$ - [NC,L]
    RewriteRule ^.*$ /index.php [NC,L]
</Location>

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top