Nginx and Redirects
-
Hello,
I’m fairly new to nginx, I have the latest version and I’m running it on centos 6. WordPress is currently installed on the root of my domain.
Everything is working perfectly, even got permalinks working just fine.
My problem is, whenever I click my link from a Google search, it will go to my root domain. It took me a minute but I figured out why.
Google is displaying mysite.com/specific-post and I have a 301 setup for non-www to go to www.
I believe I need to fix the redirect so it not only redirects to www, but to the http://www.site.com/specif-post I’m not sure if in the redirect its /$ for variable or what. Here is my current code.
server { listen 80; server_name site.com; rewrite ^ http://www.site.com permanent; } server { listen 80; server_name www.site.com; root /usr/local/nginx/html/site.com; index index.php; include /usr/local/nginx/custom/gzip.conf; include /usr/local/nginx/custom/php.conf; location / { try_files $uri $uri/ /index.php; } }
If someone could please tell me the redirect variable to get it to pass on to the redirected URL that would be awesome!
Thanks in advanced!
- The topic ‘Nginx and Redirects’ is closed to new replies.