C:\xampp\apache\conf\extra\httpd-vhosts.conf
<VirtualHost *:80>
##ServerAdmin webmaster@tutorial
DocumentRoot c:/xampp/htdocs/tutorial
ServerName tutorial
ServerAlias tutorial.local
</VirtualHost>
C:\Windows\System32\drivers\etc\hosts
127.0.0.1 tutorial
127.0.0.1 tutorial.local
either:
CREATE DATABASE IF NOT EXISTS `tutorial` DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
or Manually
Project URL: http://tutorial/
<?php
return [
'class' => 'yii\db\Connection',
'dsn' => 'mysql:host=localhost;dbname=tutorial',
'username' => 'root', // or your Username
'password' => '', // enter your password if you have used one
'charset' => 'utf8',
// Schema cache options (for production environment)
//'enableSchemaCache' => true,
//'schemaCacheDuration' => 60,
//'schemaCache' => 'cache',
];
<?php
return [
'adminEmail' => '[email protected]', // Your EMAIL address
'supportEmail' => '[email protected]', // Your EMAIL address
'user.passwordResetTokenExpire' => 3600,
'company' => 'jlavelle.uk', // Your Company name or your name
];
to $config = [
add: 'name' => 'yii2Stuff',
to $config = [ 'components' => [
uncomment:
'urlManager' => [
'enablePrettyUrl' => true,
'showScriptName' => false,
'rules' => [
],
],
Required if you've configured PrettyUrls
# Use UTF-8 encoding for anything served as `text/html` or `text/plain`.
AddDefaultCharset utf-8
Options +FollowSymLinks
IndexIgnore */*
RewriteEngine on
# Force UTF-8 for certain file formats.
<IfModule mod_mime.c>
AddCharset utf-8 .atom .css .js .json .rss .vtt .webapp .xml
</IfModule>
# Block access to directories without a default document.
# Usually you should leave this uncommented because you shouldn't allow anyone
# to surf through every directory on your server (which may includes rather
# private places like the CMS's directories).
<IfModule mod_autoindex.c>
Options -Indexes
</IfModule>
# prevent httpd from serving dotfiles (.htaccess, .svn, .git, etc.)
RedirectMatch 403 /\..*$
# Block access to hidden files and directories.
# This includes directories used by version control systems such as Git and SVN.
<IfModule mod_rewrite.c>
RewriteCond %{SCRIPT_FILENAME} -d [OR]
RewriteCond %{SCRIPT_FILENAME} -f
RewriteRule "(^|/)\." - [F]
</IfModule>
# Used to create the "pretty URLs"
<IfModule mod_rewrite.c>
# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# otherwise forward it to index.php
# RewriteRule . index.php
# RewriteRule ^(.*)\?*$ index.php/$1 [QSA] # for Pretty URLs plus Query Strings
RewriteRule ^(.*)\?*$ index.php/$1
</IfModule>
# Block access to backup and source files.
# These files may be left by some text editors and can pose a great security
# danger when anyone has access to them.
<FilesMatch "(^#.*#|\.(bak|config|dist|fla|inc|ini|jql|log|psd|sh|sql|sw[op])|~)$">
Order allow,deny
Deny from all
Satisfy All
</FilesMatch>
# ------------------------------------------------------------------------------
# | Content transformations |
# ------------------------------------------------------------------------------
# Prevent some of the mobile network providers from modifying the content of
# your site: http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9.5.
<IfModule mod_headers.c>
Header set Cache-Control "no-transform"
</IfModule>
NavBar
'brandLabel' => Yii::$app->name,
Footer
<p class="pull-left">©<?= date('Y') . ' ' . Yii::$app->params['company'] ?></p>