需要帮助在这个网址htaccess

时间:2015-04-28 06:33:23

标签: php .htaccess mod-rewrite yii2

我在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

3 个答案:

答案 0 :(得分:0)

尝试查看this solution helps

答案 1 :(得分:0)

这个解决方案怎么样?

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]

答案 2 :(得分:0)

将此添加到.htaccess文件中。

RewriteBase /

我安装了Grav并且也遇到了这个问题,但现在它正在运行。 http://kazeflame.elementfx.com/home