我在windows 8.1 pro上使用winginx。我是新手使用它。我想在Windows上爲nginx啓用url重寫,以便像這樣的鏈接「http://mysite.dev/portfolio/latest/business-card-design/」正常工作。我想專門與wordpress和laravel合作。我發現如何將.htaccess文件轉換爲nginx,但我不知道把它們放在哪裏。我希望你的專家們瞭解我的問題。對不起我的英語不好。請幫幫我。謝謝。如何在Windows PC上的nginx中啓用url重寫
-2
A
回答
0
我下載Winginx和安裝Wordpress 4.0.1,這是我的配置:
server {
listen 127.0.0.1:80;
server_name example.com www.example.com;
root home/example.com/public_html;
index index.php index.html;
log_not_found off;
access_log logs/example.com-access.log;
charset utf-8;
location ~ /\. { deny all; }
location = /favicon.ico { }
location = /robots.txt { }
if (!-e $request_filename) {
rewrite ^(.+)$ /index.php?q=$1 last;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;
include fastcgi_params;
}
}
利用這種配置,通過Winginx產生的,我的網站能正常工作,並且我已經加入了只有部分是URL重寫部分:
if (!-e $request_filename) {
rewrite ^(.+)$ /index.php?q=$1 last;
}
當然,你必須從設置>永久鏈接選擇你的固定鏈接設置,以獲得你想要的URL。
+0
謝謝soooooooooooooooooooooooo我親愛的。有用。我必須根據我的服務器名稱和它的根來更改服務器名稱,root的值。 Wooow。它的效果很好。我非常高興。再次感謝您的大力幫助。 – 2014-12-08 20:25:38
+0
不客氣。 – akmozo 2014-12-08 20:28:10
相關問題
- 1. 如何在nginx中寫入url重寫?
- 2. 如何在Ubuntu,nGinx和codeigniter中啓用URL重寫?
- 3. 用NGINX重寫URL
- 4. 在nginX中重寫URL
- 5. Nginx的URL重寫
- 6. 如何在nginx上重寫?
- 7. Nginx的URL重寫
- 8. 重寫url中的Nginx proxy_pass?
- 9. Nginx URL重寫更改URL
- 10. 在Windows上啓用Nginx上的http2
- 11. 重寫nginx pushState-URL的
- 12. Nginx的URL重寫規則
- 13. 在Windows上用PHP重寫URL IIS
- 14. 重寫URL的Glype(nginx)
- 15. Nginx的重寫URL ARGS
- 16. nginx用URL重寫部分url? mark
- 17. 在nginx中重寫動態URL
- 18. Nginx重寫URL問題
- 19. wordpress,nginx和重寫url
- 20. nginx彈簧mvc url重寫
- 21. nginx的URL重寫(無重定向)
- 22. 重寫NGINX URL位置?
- 23. 如何在Server 2012的IIS 8.5中啓用「URL重寫」模塊?
- 24. nginx proxy_pass與URL重寫 - 保存URL
- 25. 如何在nginx中重寫或代理url?
- 26. 如何變換(重寫)在nginx的URL的一部分
- 27. 重寫url,但顯示原始URL + nginx
- 28. NGINX動態URL的重寫規則
- 29. 如何在Nginx中用try_file重寫此nginx命令?
- 30. Nginx的不重寫某些URL的
看看這裏:[nginx http rewrite module](http://nginx.org/en/docs/http/ngx_http_rewrite_module.html),它可以幫助你做你正在尋找的東西。 – akmozo 2014-12-02 16:36:43
你好,非常感謝你的回覆。但我很抱歉,我無法通過鏈接解決我的問題。我對nginx真的很陌生。我不知道如何配置wordpress漂亮url的url重寫。這是一個比xmapp快的服務器。但我非常難過,我無法使它適合我的wordpress主題開發與漂亮的網址。我在谷歌YouTube上搜索解決方案,但找不到合適的解決方案。請幫助我容易理解的細節。非常感謝你。 – 2014-12-02 20:00:17
不要急躁,花點時間找到你要找的東西,然後做你想做的事。我不知道如何用nginx做wordpress,但我知道谷歌知道它;)所以看看[這裏](http://wiki.nginx.org/WordPress)和[這裏](http:///codex.wordpress.org/Nginx)。 – akmozo 2014-12-02 20:09:11