.htaccess between developemt, staging, and production

前端 未结 4 2230
予麋鹿
予麋鹿 2020-12-28 17:55

I\'m working on a app that uses url rewrites and has a specific .htaccess configuration. When working on the app I have three eviorments:

  1. Developent on my loca
4条回答
  •  无人及你
    2020-12-28 18:15

    # Development
    
    RewriteEngine on
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} !=/favicon.ico
    RewriteCond %{HTTP_HOST} ^localhost
    RewriteRule ^(.*)$ /app/index.php?request=$1 [L,QSA]
    
    # Staging
    
    RewriteEngine on
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} !=/favicon.ico
    RewriteCond %{HTTP_HOST} ^staging.mydomain.com
    RewriteRule ^(.*)$ /html/app/index.php?request=$1 [L,QSA]
    
    # Production
    
    RewriteEngine on
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} !=/favicon.ico
    RewriteCond %{HTTP_HOST} ^www.mydomain.com
    RewriteRule ^(.*)$ /index.php?request=$1 [L,QSA]
    

提交回复
热议问题