簡體   English   中英

在此網址htaccess中需要幫助

[英]Need help in this url htaccess

我在x10hosting網站上載了yii2 basic。 它工作正常,但網址看起來不好。這是示例網址

http://myappdomain.x10host.com/home/myfolderapp/public_html/site/contact

我用這個htaccess

Options +FollowSymLinks
IndexIgnore */*

RewriteEngine on

# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

# otherwise forward it to index.php
RewriteRule . index.php

我該如何刪除這部分

home/myfolderapp/public_html

這樣看起來像這樣

http://myappdomain.x10host.com/site/contact

這個解決方案怎么樣?

RewriteEngine on
# Change yourdomain.com to be your main domain.
RewriteCond %{HTTP_HOST} ^(www.)?myappdomain.x10host.com$
# Change 'subdirectory' to be the directory you will use for your main domain.
RewriteCond %{REQUEST_URI} !^/home/myfolderapp/public_html/
# Don't change this line.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Change 'subdirectory' to be the directory you will use for your main domain.
RewriteRule ^(.*)$ /home/myfolderapp/public_html/$1
# Change yourdomain.com to be your main domain again.
# Change 'subdirectory' to be the directory you will use for your main domain
# followed by / then the main file for your site, index.php, index.html, etc.
RewriteCond %{HTTP_HOST} ^(www.)?myappdomain.x10host.com$
RewriteRule ^(/)?$ home/myfolderapp/public_html/index.php [L]

將此添加到您的.htaccess文件。

RewriteBase /

我安裝了Grav並也遇到了這個問題,但是現在可以正常工作了。 http://kazeflame.elementfx.com/home

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM