.htaccess 在子目录中安装Codeigniter 4并保持域通用URL结构 当前情况:
我已经在.htaccess 在子目录中安装Codeigniter 4并保持域通用URL结构 当前情况:,.htaccess,codeigniter,.htaccess,Codeigniter,我已经在http://example.com而且该网站是多语言网站,因此您可以在http://example.com/en/something-here/您可以在http://example.com/es/algo-aqui/ 我想做的是: 我想在http://example.com/software/但是我想保留一般的网站URL结构,所以我需要能够通过URL访问CI4软件http://example.com/en/software/和http://example.com/es/software
http://example.com
而且该网站是多语言网站,因此您可以在http://example.com/en/something-here/
您可以在http://example.com/es/algo-aqui/
我想做的是:
我想在http://example.com/software/
但是我想保留一般的网站URL结构,所以我需要能够通过URL访问CI4软件http://example.com/en/software/
和http://example.com/es/software/
。始终阅读本段开头提到的相同CI4安装
我已经尝试过的:
我在http://example.com/software/
并修改了Wordpress站点和CodeIgniter的.htaccess
文件
这是我在根目录下的WP.htaccess
文件:
# Disable directory browsing
Options All -Indexes
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^[a-z]{2}/software(.*)$ /software/index.php$2 [L]
</IfModule>
# BEGIN WordPress
# Las directivas (líneas) entre `BEGIN WordPress` y `END WordPress` se generan dinámicamente
# , y solo se deberían modificar mediante filtros de WordPress.
# Cualquier cambio en las directivas que hay entre esos marcadores se sobreescribirán.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
# Disable directory browsing
Options All -Indexes
# ----------------------------------------------------------------------
# Rewrite engine
# ----------------------------------------------------------------------
# Turning on the rewrite engine is necessary for the following rules and features.
# FollowSymLinks must be enabled for this to work.
<IfModule mod_rewrite.c>
Options +FollowSymlinks
RewriteEngine On
# If you installed CodeIgniter in a subfolder, you will need to
# change the following line to match the subfolder you need.
# http://httpd.apache.org/docs/current/mod/mod_rewrite.html#rewritebase
RewriteBase /
# Redirect Trailing Slashes...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Rewrite "www.example.com -> example.com"
RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^ http://%1%{REQUEST_URI} [R=301,L]
# Checks to see if the user is attempting to access a valid file,
# such as an image or css document, if this isn't true it sends the
# request to the front controller, index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) /software/index.php/$1
# Ensure Authorization header is passed along
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</IfModule>
<IfModule !mod_rewrite.c>
# If we don't have mod_rewrite installed, all 404's
# can be sent to index.php, and everything works as normal.
ErrorDocument 404 index.php
</IfModule>
# Disable server signature start
ServerSignature Off
# Disable server signature end
我得到的错误是:
我可以访问网站和软件。该网站运行良好,但当我尝试访问时,比如说http://example.com/en/software/
,访问Codeigniter时出现404错误。错误消息显示:“找不到控制器或其方法:App\Controllers\En::software”
这就好像CI试图找到控制器En
(不存在)和方法软件
任何帮助都将不胜感激。您的问题解决了吗?您的问题解决了吗?