如何从子域嵌套文件夹中删除 index.php

我的根目录中有主域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} off

RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]


RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.*)$ index.php?/$1 [L]

</IfModule>


<IfModule !mod_rewrite.c>

  ErrorDocument 404 /index.php

</IfModule>

我的子域 .htaccess


RewriteEngine on


# Redirect on https:

RewriteCond %{HTTPS} off

RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]


RewriteCond $1 !^(index\.php|resources|robots\.txt)

RewriteCond %{ENV:REDIRECT_STATUS} ^$

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.*)$ 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


DIEA
浏览 153回答 2
2回答

繁星coding

请使用以下代码并 在您的 .htaccess 文件中更新 RewriteBase /root_directory/subdomain_folder_name/。<IfModule mod_rewrite.c>RewriteEngine OnRewriteBase /root_directory/subdomain_folder_name/RewriteCond %{REQUEST_FILENAME} !-fRewriteCond %{REQUEST_FILENAME} !-dRewriteRule ^(.*)$ index.php?/$1 [L,QSA]</IfModule>我希望这对你有帮助。
打开App,查看更多内容
随时随地看视频慕课网APP