Jump to content
php.lv forumi

Apache mod rewrite


Trac3 !!

Recommended Posts

Sveiki.

 

Mēģinu redirektēt visus domēna subdomēnus uz domēnu example.com, bet izveidojies cikls cik sapratu no logiem..

 

<VirtualHost *:80>
   DocumentRoot "/home/example.com"
   ServerName example.com
   DirectoryIndex index.php
 <Directory "/home/example.com">
     Options FollowSymLinks
     Options -Indexes
     AllowOverride All
     Order allow,deny
     Allow from all
 </Directory>
</VirtualHost>

<VirtualHost *:80>
   ServerName www.example.com
   ServerAlias *.example.com
   RedirectMatch 303 (.*) http://example.com$1
</VirtualHost>

Jau iepriekš paldies par atbildēm.

Edited by Trac3 !!
Link to comment
Share on other sites

Tik tālu esmu ticis, bet nestrādā vēl.. :/

 

<VirtualHost *:80>
   DocumentRoot "/home/example.com"
   ServerName example.com
   DirectoryIndex index.php
 <Directory "/home/example.com">
     Options FollowSymLinks
     Options -Indexes
     AllowOverride All
     Order allow,deny
     Allow from all
 </Directory>
</VirtualHost>

<VirtualHost *:80>
   ServerAlias *.example.com
   Options +FollowSymlinks
   RewriteEngine on

   RewriteCond %{HTTP_HOST} ^([^\.]+)\.example\.com
   RewriteRule ^(.*)$ http://example.com/$1 [R=301,L]
</VirtualHost>

Link to comment
Share on other sites

<VirtualHost *:80>
   DocumentRoot "/home/example.com"
   ServerName example.com
   DirectoryIndex index.php
 <Directory "/home/example.com">
     Options FollowSymLinks
     Options -Indexes
     AllowOverride All
     Order allow,deny
     Allow from all
 </Directory>
</VirtualHost>

<VirtualHost *:80>
   ServerName www.example.com
   ServerAlias *.example.com
   RewriteEngine on
   RewriteCond %{HTTP_HOST} !^example\.com$ [NC]
   RewriteRule ^/(.*)$ http://example.com/$1 [R=301,L]
</VirtualHost>

 

Šis ir mans gala variants, kas strādā. :)

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...