我在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. URL重写Nginx
- 5. 在nginX中重写URL
- 6. 如何在nginx上重写?
- 7. Nginx的URL重写
- 8. 如何写nginx的主URL重写
- 9. Magento,如何重写URL中的index.php? (nginx)
- 10. Nginx的URL重写
- 11. 重写url中的Nginx proxy_pass?
- 12. Nginx重写root url
- 13. Nginx URL重写更改URL
- 14. 在Windows上启用Nginx上的http2
- 15. 重写nginx pushState-URL的
- 16. Nginx的URL重写规则
- 17. 在Windows上用PHP重写URL IIS
- 18. 重写URL的Glype(nginx)
- 19. 在nginx上的URL查询中重写空格(使用快递)
- 20. Nginx的 - URL重写规则
- 21. nginx不重写URL的opencart
- 22. nginx WordPress的URL重写
- 23. Nginx的重写URL ARGS
- 24. nginx的重写URL子
- 25. nginx的URL重写规则
- 26. nginx用URL重写部分url? mark
- 27. Nginx的 - 重写URL到$ url.php,如果不存在,改写为$ URL/
- 28. 如何在webfaction上重新启动nginx?
- 29. 在nginx中重写动态URL
- 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