我将根文档文件夹更改为使用子目录,但是它不起作用

时间:2019-06-21 05:14:20

标签: .htaccess

我要实现的是我的domain.com将使用/ new子目录作为根文档文件夹,但是当我尝试访问该站点时,它将重定向到domain.com/new,这不是我想要的

该脚本以前可以运行,但是在我编辑脚本以使用其他文件夹后,该脚本无法正常工作。

RewriteEngine on
RewriteCond %{HTTP_HOST} ^domain-name.com$ [NC,OR]
RewriteCond %{HTTP_HOST} ^www.domain-name.com$
RewriteCond %{REQUEST_URI} !new/
RewriteRule (.*) /new/$1 [L]

它将我重定向到domain.com/new。我不希望/ new在网址中显示。预先谢谢你!

1 个答案:

答案 0 :(得分:0)

通过此重写更改规则

<p>Lorem ipsum dolor sit amet consectetur, adipisicing elit. Quasi, harum.</p>
<div class="buttons">
  <button>Button 1</button>
  <button>Button 2</button>
  <button>Button 3</button>
  <button>Button 4</button>
  <button>Button 5</button>
  <button>Button 6</button>  
  <button>Button 7</button>
  <button>Button 8</button>
</div>
<br/>Image: <br/>
<img src="https://www.sarahsflowers.co.uk/wpcms/wp-content/uploads/2013/10/Orange-Silk-Gerbera-Wedding-Flower-Sample1.jpg" height="200"/>

<p>Lorem ipsum, dolor sit amet consectetur adipisicing elit. Id quaerat dignissimos aperiam incidunt molestias officiis ullam iusto consequuntur, obcaecati impedit nemo nesciunt ratione similique cumque? Deserunt reprehenderit pariatur officiis nisi natus.
  Cupiditate culpa mollitia ad beatae voluptates similique quos obcaecati magnam saepe commodi quae, facilis a assumenda suscipit ab? Aut?</p>