htaccess为子域名

Sta*_*asa 1 .htaccess mod-rewrite

需要帮助.htaccess我的本地主机上有这个.htaccess的网站

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ website/index.php/$1 [L]
Run Code Online (Sandbox Code Playgroud)

现在我想将网站移至subdomain.domain.com

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ http://subdomain.domain.com/index.php/$1 [L]
Run Code Online (Sandbox Code Playgroud)

我抓住了网址,但这不起作用,也许是因为这是我不知道的子域名

托管详情:

#   Subdomain Name              Path [?]    
1   subdomain.domain.com    /home/www/subdomain.domain.com
Run Code Online (Sandbox Code Playgroud)

我的网址是这样的

HTTP://website/index.php/contact

有了这个htaccess,我可以使用

HTTP://网站/联系方式

当我将网站移动到子域名时,我可以使用http://subdomain.website/index.php/contact,但是当尝试http://subdomain.website/contact给我错误时

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.
Run Code Online (Sandbox Code Playgroud)

小智 5

试试这个,它应该适用于所有域localhost和服务器.

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]
Run Code Online (Sandbox Code Playgroud)

确保服务器上的"rewrite_engine = on".