2016-01-11, 09:31 PM
hi all,
I'm hoping someone who is more experienced with nginx can lend a hand here...recent convert from apache. I did not have this issue when using apache so my guess is that it's an nginx conf/rewrite issue somewhere.
for some reason, a second slash is being added to some links on my forum...ex: http://mysite.com//thread-blah. for some reason when I try to have www.mysite.com redirect to mysite.com, it's adding a double slash as well.
for mybb, I'm using google seo and I have "Enable search engine friendly URLs?" disabled in the admin cp.
here's my nginx vhost conf:
I'm hoping someone who is more experienced with nginx can lend a hand here...recent convert from apache. I did not have this issue when using apache so my guess is that it's an nginx conf/rewrite issue somewhere.
for some reason, a second slash is being added to some links on my forum...ex: http://mysite.com//thread-blah. for some reason when I try to have www.mysite.com redirect to mysite.com, it's adding a double slash as well.
for mybb, I'm using google seo and I have "Enable search engine friendly URLs?" disabled in the admin cp.
here's my nginx vhost conf:
#server {
#server_name www.mysite.com;
#return 301 $scheme://mysite.com$request_uri;
#}
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
root /sites/public_html;
index index.php index.html index.htm;
# Make site accessible from http://localhost/
server_name mysite.com www.mysite.com;
# Logs
access_log /sites/logs/access.log;
error_log /sites/logs/error.log info;
location /inc {
deny all;
return 403;
}
location / {
autoindex on;
#Mybb Rewrites
rewrite ^/([^&]*)&(.*)$ http://mysite.com/$1?$2 permanent;
# Google SEO Sitemap:
rewrite ^/((?i)sitemap-([^./]+)\.xml)$ /misc.php?google_seo_sitemap=$2;
# Google SEO URL Forums:
rewrite ^/((?i)forum-([^./]+))$ /forumdisplay.php?google_seo_forum=$2;
# Google SEO URL Threads:
rewrite ^/((?i)thread-([^./]+))$ /showthread.php?google_seo_thread=$2;
# Google SEO URL Announcements:
rewrite ^/((?i)announcement-([^./]+))$ /announcements.php?google_seo_announcement=$2;
# Google SEO URL Users:
rewrite ^/((?i)user-([^./]+))$ /member.php?action=profile&google_seo_user=$2;
# Google SEO URL Calendars:
rewrite ^/((?i)calendar-([^./]+))$ /calendar.php?google_seo_calendar=$2;
# Google SEO URL Events:
rewrite ^/((?i)event-([^./]+))$ /calendar.php?action=event&google_seo_event=$2;
try_files $uri $uri/ =404;
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}