을 newyork의 폴더 안에 htaccess로이 시도하고 내부 서버 오류
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /home/thepaleo/public_html/newyork/
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
</IfModule>
감사를 얻을 수있다 , 다음과 같은 디렉토리 구조를 가지고 있습니다 :
public_html
webroot
controllers
...and all cakephp folders
index.php -of cake-
.htaccess
Hosts -folder at which subdomains folders-
dir -folder that contains another cakephp project called dir-
all cakephp folders and files
내 기본 도메인에서 Cakephp 앱을 실행하고 dir.mydomain.com에서 다른 CakePHP 앱을 실행합니다.
다음으로 public_html에서의 .htaccess이다
# Turn off the ETags
Header unset ETag
FileETag None
# Turn off the Last Modified header except for html docs
<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|mp3)$">
Header unset Last-Modified
</FilesMatch>
<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf|mp3)$">
Header set Expires "Thu, 15 Jan 2015 20:00:00 GMT"
</FilesMatch>
<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf|mp3)$">
Header set Cache-Control "max-age=31449600"
</FilesMatch>
# Use PHP5.3 as default
AddHandler application/x-httpd-php54 .php
#Deny from mydomain.com/Host/
Redirect /Host/dir/ http://dir.mydomain.com/
<IfModule mod_rewrite.c>
#RewriteRule .* http://%{SERVER_NAME}%{REQUEST_URI} [R,L]
RewriteEngine on
#RewriteCond %{HTTPS} =on
#RewriteBase /~username/
RewriteRule ^$ webroot/ [L]
RewriteRule (.*) webroot/$1 [L]
</IfModule>
AddType audio/mpeg mp3
AddType text/xml xml
으로 public_html/public_html을 웹 루트 및/호스트되는 다음의 .htaccess /으로 public_html/호스트 DIR
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
</IfModule>
은 IS 다음의 .htaccess/dir/webroot
Options -Multiviews -Indexes +SymLinksIfOwnerMatch
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase/
DirectorySlash Off
RewriteCond %{HTTP_HOST} !^dir.mydomain.com$ [NC]
RewriteRule ^(.*)$ http://dir.mydomain.com/$1 [L,R=301]
RewriteRule ^/?searches/index/(.*)$ /searches/$1 [R=301,L]
RewriteRule ^(.*)/page:1$ /$1 [R=301,L]
RewriteRule ^(.*)\/(\?.*)?$ $1$2 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
</IfModule>
AddType audio/mpeg mp3
AddType text/xml xml
그런데 내 공유 호스팅은 하위 디렉토리를 만드는 것을 지원합니다. Cpanel에서 오즈. 또한 CakePHP 코어를 애플리케이션 구조와 분리하고 다음과 같이 webroot/index.php에 정의했습니다.
if (!defined('CAKE_CORE_INCLUDE_PATH')) {
define('CAKE_CORE_INCLUDE_PATH', DS.'home2'.DS.'username'.DS.'libs'.DS.'cakephp');
}
플러그인을 사용해 보셨습니까? – SaidbakR
아니요. htaccess로이 작업을 수행하고 싶습니다. 그 작업이 가능하다는 것을 알고 있습니다. 그냥 어떻게 .. 모르겠다. – Rahul