我的根目錄中有主域http://example.com,我所有的子域都在目錄文件夾 /catalogs/subdomain1,/catalogs/subdomain2.Currently 我的子域 url 在http://subdomain.example.com/index .php我想從我的子域中刪除 index.php。我的根 .htaccess 文件代碼是<IfModule mod_rewrite.c>RewriteEngine On# Redirect on https:RewriteCond %{HTTPS} offRewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]RewriteBase /RewriteCond %{REQUEST_FILENAME} !-fRewriteCond %{REQUEST_FILENAME} !-dRewriteRule ^(.*)$ index.php?/$1 [L]</IfModule><IfModule !mod_rewrite.c> ErrorDocument 404 /index.php</IfModule>我的子域 .htaccessRewriteEngine on# Redirect on https:RewriteCond %{HTTPS} offRewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]RewriteCond $1 !^(index\.php|resources|robots\.txt)RewriteCond %{ENV:REDIRECT_STATUS} ^$RewriteCond %{REQUEST_FILENAME} !-fRewriteCond %{REQUEST_FILENAME} !-dRewriteRule ^(.*)$ index.php/$1 [L,QSA]Options -Indexes# php -- BEGIN cPanel-generated handler, do not edit# Set the “ea-php56” package as the default “PHP” programming language.<IfModule mime_module> AddHandler application/x-httpd-ea-php56 .php .php5 .phtml</IfModule># php -- END cPanel-generated handler, do not edit
2 回答

繁星coding
TA貢獻1797條經驗 獲得超4個贊
請使用以下代碼并 在您的 .htaccess 文件中更新 RewriteBase /root_directory/subdomain_folder_name/。
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /root_directory/subdomain_folder_name/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L,QSA]
</IfModule>
我希望這對你有幫助。
- 2 回答
- 0 關注
- 186 瀏覽
添加回答
舉報
0/150
提交
取消