Skip to main content
Topic: .htaccess problems holding up new site :( (Read 581 times) previous topic - next topic

.htaccess problems holding up new site :(

I thought I had figured it all out, but today when we deployed the new site on this server there are some really nasty issues with redirects that make it impossible to launch the new site. DEV will be closed until we can get this figured out.

Background:

Apache root is /var/apps/dangercore/public

/public has .htaccess that is supposed to redirect all the old blog stuff from the root at dangerousprototypes.com/ to dangerousprototypes.com/blog. That part works.

The new site is installed and browsing works ok, but trying to login always gives a 502 bad gateway error (from nginx, not apache). Password reset and account register just fail.

Here's the .htaccess. Any suggestions or ideas are certainly welcome.

Code: [Select]
# MAKE SURE TO LEAVE THE NEXT TWO LINES HERE.
# BEGIN DENY LIST --
# END DENY LIST --

Options -Indexes
Options +FollowSymlinks

SetEnvIf X-Cluster-Client-Ip "^211.101.19.11" DenyAccess
Order Allow,Deny
Deny from env=DenyAccess
Allow from all

#remove www DP
RewriteEngine On
RewriteCond %{HTTP_HOST}  ^www.dangerousprototypes.com [nocase]
RewriteRule ^(.*)        http://dangerousprototypes.com/$1 [last,redirect=301]

RewriteRule ^sitemap(-+([a-zA-Z0-9_-]+))?.xml(.gz)?$ /blog/sitemap$1.xml$2 [L]

# Redirect front page to /blog/
RewriteRule ^(/|)$ http://dangerousprototypes.com/blog/ [R=301,L,QSA]

# Redirect old WordPress pagenation
RewriteRule ^page/(.*)$ http://dangerousprototypes.com/blog/page/$1 [R=301,L,QSA]

# Redirect old WordPress posts and content to /blog/
RewriteRule ^2016/(.*)$ http://dangerousprototypes.com/blog/2016/$1 [R=301,L,QSA]
RewriteRule ^2015/(.*)$ http://dangerousprototypes.com/blog/2015/$1 [R=301,L,QSA]
RewriteRule ^2014/(.*)$ http://dangerousprototypes.com/blog/2014/$1 [R=301,L,QSA]
RewriteRule ^2013/(.*)$ http://dangerousprototypes.com/blog/2013/$1 [R=301,L,QSA]
RewriteRule ^2012/(.*)$ http://dangerousprototypes.com/blog/2012/$1 [R=301,L,QSA]
RewriteRule ^2011/(.*)$ http://dangerousprototypes.com/blog/2011/$1 [R=301,L,QSA]
RewriteRule ^2010/(.*)$ http://dangerousprototypes.com/blog/2010/$1 [R=301,L,QSA]
RewriteRule ^2009/(.*)$ http://dangerousprototypes.com/blog/2009/$1 [R=301,L,QSA]
RewriteRule ^wp-admin/?(.*)?$ http://dangerousprototypes.com/blog/wp-admin/$1 [R=301,L,QSA]
RewriteRule ^category/(.*)$ http://dangerousprototypes.com/blog/category/$1 [R=301,L,QSA]
RewriteRule ^tag/(.*)$ http://dangerousprototypes.com/blog/tag/$1 [R=301,L,QSA]
RewriteRule ^wp-content/(.*)$ http://dangerousprototypes.com/blog/wp-content/$1 [R=301,L,QSA]
RewriteRule ^wp-includes/(.*)$ http://dangerousprototypes.com/blog/wp-includes/$1 [R=301,L,QSA]

# Old WordPress links redirect to /blog/ with and without trailing slash
RewriteRule ^feed/?$ http://dangerousprototypes.com/blog/feed/ [R=301,L,QSA]
RewriteRule ^our-projects/?$ http://dangerousprototypes.com/blog/our-projects/ [R=301,L,QSA]
RewriteRule ^twatch-manual/?$ http://dangerousprototypes.com/blog/twatch-manual/ [R=301,L,QSA]
RewriteRule ^usb-ir-toy-manual/?$ http://dangerousprototypes.com/blog/usb-ir-toy-manual/ [R=301,L,QSA]
RewriteRule ^web-platform-manual/?$ http://dangerousprototypes.com/blog/web-platform-manual/ [R=301,L,QSA]
RewriteRule ^open-logic-sniffer/?$ http://dangerousprototypes.com/blog/open-logic-sniffer/ [R=301,L,QSA]
RewriteRule ^flash-destroyer-manual/?$ http://dangerousprototypes.com/blog/flash-destroyer-manual/ [R=301,L,QSA]
RewriteRule ^disclaimer/?$ http://dangerousprototypes.com/blog/disclaimer/ [R=301,L,QSA]
RewriteRule ^contact/?$ http://dangerousprototypes.com/blog/contact/ [R=301,L,QSA]
RewriteRule ^about/?$ http://dangerousprototypes.com/blog/about/ [R=301,L,QSA]
RewriteRule ^hacker-camp-shenzhen/?$ http://dev.dangerousprototypes.com/subscribe/hackercampshenzhen/ [R=301,L,QSA]
RewriteRule ^hackercampshenzhen/?(.*)?$ http://dev.dangerousprototypes.com/subscribe/hackercampshenzhen/ [R=301,L,QSA]

RewriteRule ^open7400/?(.*)?$ http://dangerousprototypes.com/blog/open7400/$1 [R=301,L,QSA]
#http://dangerousprototypes.com/open7400/entry-and-judging-criteria/

RewriteRule ^open-7400-logic-competition/?(.*)?$ http://dangerousprototypes.com/blog/open-7400-logic-competition/$1 [R=301,L,QSA]
#http://dangerousprototypes.com/open-7400-logic-competition/open-7400-competition-entry-form/

RewriteRule ^bus-pirate-manual/?(.*)?$ http://dangerousprototypes.com/blog/bus-pirate-manual/$1 [R=301,L,QSA]
#http://dangerousprototypes.com/bus-pirate-manual/bus-pirate-1-wire-guide/

RewriteEngine On
#RewriteBase /dangercore/
RewriteBase /

RewriteRule ^(system|application|cgi-bin) - [F,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

#RewriteRule .* public/index.php/$0 [PT,L]
RewriteRule .* index.php/$0 [PT,L]
Got a question? Please ask in the forum for the fastest answers.

Re: .htaccess problems holding up new site :(

Reply #1
Since I relocated webroot from /var/www to /var/apps/dangercore/public I wonder if NGINX needs an update too. I'm not familiar with it. I am going to restore webroot to /var/www and make www a symlink to the new site and see if that helps.
Got a question? Please ask in the forum for the fastest answers.

Re: .htaccess problems holding up new site :(

Reply #2
Seems to be the latter issue. We turned off NGINX and everything works properly, will continue on it tomorrow, unfortunately that is also a travel day for me and our lead developer is getting married...
Got a question? Please ask in the forum for the fastest answers.

Re: .htaccess problems holding up new site :(

Reply #3
Got it going. Or rather found out what was wrong and did a lazy fix.

For some. reason headers were exceeding 4k for admin logins so nginx crashed. Increased limit to 8k and all is good. Now we have to figure out what is bloating the headers :)
Got a question? Please ask in the forum for the fastest answers.