我有一個奇怪的問題.htaccess
和網址。我有這個htaccess的Htaccess的問題,無法弄清楚
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /sitesubfolder/
RewriteRule ^test$ pages/test.php
</IfModule>
這對我的HREF鏈接
<a href="test/"> Link </a>
該網站是在子文件夾不是根目錄和路徑是/var/www/www/site/
當我去的網站網址,然後點擊刷新鏈接頁面,但保持在同一頁面上。如果我再次點擊url變成site.com/test/test/test ..每次點擊Link時,只需再在頁面上放置一個/test/
即可。
服務器是nginx如果是問題。
我已經添加了這site.conf
server {
root /var/www/www/site/;
index index.php index.html;
location/{
try_files $uri $uri/ /index.php?$query_string;
}
....
}
不過還是一樣的(我重新加載nginx的也可以)
'.htaccess'是一個Apache文件,你正在使用'nginx'。 –
呵呵,不知道這個..並且沒有辦法在'ngi中使用它nx'?我該如何重寫網址並製作「漂亮」的網址? – VLS
'nginx'由'nginx.conf'或其中包含的文件之一配置。您需要查看您現有的配置,但'.htaccess'很容易使用['try_files'指令](http://nginx.org/en/docs/http/ngx_http_core_module.html#try_files)實現。 –