Код: Выделить всё
/другой код
/new_extension
index.php
и оно работало бы по этому адресу как обычное yii приложение
Код: Выделить всё
www.example.com/new_extension/controller/action
Код: Выделить всё
/другой код
/new_extension
index.php
Код: Выделить всё
www.example.com/new_extension/controller/action
Настраивайте nginx на сервере и указывайте location вашего index.php
Код: Выделить всё
'components' => [
'request' => [
'cookieValidationKey' => ...,
'baseUrl' => '/new_extension'
],
Код: Выделить всё
# Mod_Autoindex
<IfModule mod_autoindex.c>
Options -Indexes
</IfModule>
#Mod_Rewrite
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_URI} ^(.*)$
RewriteRule ^(.*)$ web/$1
</IfModule>
Помогло) огромное спасибоandku83 писал(а): ↑2018.08.09, 20:09.htaccess в папке new_extension:Код: Выделить всё
'components' => [ 'request' => [ 'cookieValidationKey' => ..., 'baseUrl' => '/new_extension' ],
Код: Выделить всё
# Mod_Autoindex <IfModule mod_autoindex.c> Options -Indexes </IfModule> #Mod_Rewrite <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{REQUEST_URI} ^(.*)$ RewriteRule ^(.*)$ web/$1 </IfModule>
Код: Выделить всё
$baseUrl = Yii::$app->request->baseUrl;
$script = <<< JS
baseUrl = [u]'$baseUrl'[/u];
$('.add-to-oc-category').on('click', function (e) {
e.preventDefault();
var id_category = $(this).data('id_category');
var id_oc_category = $(this).data('id_oc_category');
$.ajax({
url: [u]baseUrl[/u] + '/categories/add-to-oc-category',
data: {id_category: id_category, id_oc_category: id_oc_category},
type: 'get',
success: function (res) {
},
error: function () {
// alert('error')
}
});
this.disabled;
});
JS;
Код: Выделить всё
Failed to load resource: the server responded with a status of 404 (Not Found)
http://example.com/categories/add-to-oc-category?id_category=1&id_oc_category=90
Код: Выделить всё
$url = Url::to(['controller/action']); // or Url::to(['controller/action', 'paramName' => $paramValue, ...])
$script = <<< JS
// ...
$.ajax({
url: $url,
Код: Выделить всё
Options +FollowSymlinks
# Prevent Directoy listing
Options -Indexes
# Prevent Direct Access to files
<FilesMatch "(?i)((\.tpl|.twig|\.ini|\.log|(?<!robots)\.txt))">
Require all denied
## For apache 2.2 and older, replace "Require all denied" with these two lines :
# Order deny,allow
# Deny from all
</FilesMatch>
RewriteEngine On
RewriteBase /
RewriteRule ^sitemap.xml$ index.php?route=extension/feed/google_sitemap [L]
RewriteRule ^googlebase.xml$ index.php?route=extension/feed/google_base [L]
RewriteRule ^system/storage/(.*) index.php?route=error/not_found [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !.*\.(ico|gif|jpg|jpeg|png|js|css)
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]
Код: Выделить всё
Options +FollowSymlinks
# Prevent Directoy listing
Options -Indexes
# Prevent Direct Access to files
<FilesMatch "(?i)((\.tpl|.twig|\.ini|\.log|(?<!robots)\.txt))">
Require all denied
## For apache 2.2 and older, replace "Require all denied" with these two lines :
# Order deny,allow
# Deny from all
</FilesMatch>
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/new_extension
RewriteRule ^new_extension(.*)$ new_extension/web/$1 [L]
RewriteBase /
RewriteRule ^sitemap.xml$ index.php?route=extension/feed/google_sitemap [L]
RewriteRule ^googlebase.xml$ index.php?route=extension/feed/google_base [L]
RewriteRule ^system/storage/(.*) index.php?route=error/not_found [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !.*\.(ico|gif|jpg|jpeg|png|js|css)
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]
Код: Выделить всё
RewriteCond %{REQUEST_URI} ^/new_extension
RewriteRule ^new_extension(.*)$ new_extension/web/$1 [L]