Skip to content

Instantly share code, notes, and snippets.

@warifp
Forked from umidjons/yii2-app-root-path.md
Created January 31, 2023 04:16
Show Gist options
  • Save warifp/77e14da1be7494d2d22c304c284ad7d6 to your computer and use it in GitHub Desktop.
Save warifp/77e14da1be7494d2d22c304c284ad7d6 to your computer and use it in GitHub Desktop.
Set the application root path via .htaccess

Set the application root path via .htaccess

Create .htaccess file in the application root folder.

RewriteEngine On
RewriteCond %{REQUEST_URI} !^web
RewriteRule ^(.*)$ web/$1 [L]

Also create .htaccess file in the /web/ folder:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment