We recently made a server switch and are hosting the rewrites on the server instead of in an .htaccess file. I was given this htaconf.txt printout of the rewrite rules on the server. I attempted to fix the rewrites twice, but it did not fix the issue. I believe the only two rewrites that are important are the WordPress rewrites on line 4 and the team.php rewrites where I put many pound signs to help it stand out.
The guys at the new hosting also put NGINX on the server - I'm not sure if that would do anything to change the rewrites rules, but I'm not sure what it can be at this point. Any help, hints, or suggestions would be appreciated.
I'm sorry that the file is so long, but I'm not sure which parts of the file can be contributing to the error - I assume it's only first half of the code, but I put the other code on there just to make sure I'm not missing anything.
/var/www/domain.com/ajax/.htaccess
<Directory /var/www/domain.com/ajax>
# AddHandler php5-script .php
# BEGIN WordPress
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress
ExpiresActive on
ExpiresDefault A0
php_flag display_errors on
php_value error_reporting 7
<FilesMatch "\.(inc|class)$">
SetHandler application/x-httpd-php
</FilesMatch>
Options +FollowSymLinks
php_value upload_max_filesize 20M
php_value post_max_size 20M
php_value max_execution_time 200
php_value max_input_time 200
#php_value session.save_path /mnt/target02/344586/385371/www.domain.com/web/sessions/
php_value session.cache_expire 10800
php_value session.gc_maxlifetime 10800
php_value session.gc_probability 1000
php_value session.gc_divisor 100
#php_value upload_tmp_dir /mnt/target02/344586/385371/www.domain.com/web/tmp/
#php_value session.save_path /mnt/target02/344586/385371/www.domain.com/web/sessions/
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !(www.domain.com)$ [NC]
RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301,NC,L]
RewriteCond %{QUERY_STRING} ^sport=(.*)&conference=(.*)&school=(.*)&player=(.*)$
RewriteRule ^player-profile-new\.php$ /%1/%2/%3/%4? [R=301,NC,L]
RewriteRule ^search(/(.*))?$ /search-results?q=$2 [NC,L]
#RewriteRule ^birthdays(/(.*))?$ /birthdays.php?by=$2 [NC,L]
RewriteRule ^((foot|basket)(ball))/([^/]*)/([^/]*)/([^/]*/)?((p)[0-9]+)/edit/deleteimage/([0-9]+)(/)?$ /player-profile?formmode=edit&sport=$1&conference=$4&school=$5&player=$7&deleteimage=1&imageid=$9 [NC,L]
RewriteRule ^((foot|basket)(ball))/([^/]*)/([^/]*)/([^/]*/)?((p)[0-9]+)/(edit)(/)?$ /player-profile?formmode=edit&sport=$1&conference=$4&school=$5&player=$7 [NC,L]
RewriteRule ^((foot|basket)(ball))/([^/]*)/([^/]*)/([^/]*/)?((p)[0-9]+)(/)?$ /player-profile?formmode=view&sport=$1&conference=$4&school=$5&player=$7 [NC,L]
RewriteRule ^((foot|basket)(ball))/([^/]*)/([^/]*)(/([^/]*)(/)?)?$ /team?sport=$1&conference=$4&school=$5&sort=$7 [NC,L]
RewriteRule ^directory/((foot|basket)(ball))/([^/]*)/([^/]*)(/([^/]*)(/)?)?$ /seoteam?sport=$1&conference=$4&school=$5&sort=$7&seo=yes [NC,L]
RewriteRule ^((foot|basket)(ball))/([^/]*)/([^/]*)$ /team?sport=$1&conference=$4&school=$5 [NC,L]
RewriteRule ^((foot|basket)(ball))(/)?$ /directory?sport=$1 [NC,L]
RewriteRule ^directory/((foot|basket)(ball))(/)?$ /fulldirectory.php?sport=$1&seo=yes [NC,L]
RewriteRule ^players/([^/]*)$ /player-profile.php?player=$1 [NC,L]
RewriteRule ^images/playerphotos/([^/]*)/([^/]*).jpg$ /playerphoto.php?player=$2&size=$1 [NC,L]
RewriteRule ^images/interviewphotos/([^/]*)/([^/]*).jpg$ /interviewphoto.php?interview=$2&size=$1 [NC,L]
RewriteRule ^images/captcha(.)(.)([0-9]{3}).jpg /validate.php?char=$1&type=$2&cachebuster=$3 [NC,L]
RewriteRule ^featured-interview/((p)[0-9]*)$ /featured-interview.php?playerid=$1 [NC,L]
RewriteRule ^playerpictures$ /imageviewer.php?id=181&playerid=8357&height=480&width=370&ajaxgallery=true [NC,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
</Directory>
/var/www/domain.com/wp-content/plugins/wp-minify/min/.htaccess
<Directory /var/www/domain.com/wp-content/plugins/wp-minify/min>
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^([a-z]=.*) index.php?$1 [L,NE]
</IfModule>
</Directory>
/var/www/domain.com/wp-content/w3tc/pgcache/.htaccess:
<Directory /var/www/domain.com/wp-content/w3tc/pgcache>
# BEGIN W3TC Page Cache
AddDefaultCharset UTF-8
<IfModule mod_mime.c>
AddType text/html .gzip
AddEncoding gzip .gzip
</IfModule>
<IfModule mod_deflate.c>
SetEnvIfNoCase Request_URI \.gzip$ no-gzip
</IfModule>
<IfModule mod_headers.c>
Header set X-Pingback "http://www.domain.com/xmlrpc.php"
Header set X-Powered-By "W3 Total Cache/0.9.1.3"
Header set Vary "Accept-Encoding, Cookie"
</IfModule>
# END W3TC Page Cache
</Directory>
/var/www/domain.com/wp-content/w3tc/min/.htaccess:
<Directory /var/www/domain.com/wp-content/w3tc/min>
# BEGIN W3TC Minify
<IfModule mod_mime.c>
AddEncoding gzip .gzip
<Files *.css.gzip>
ForceType text/css
</Files>
<Files *.js.gzip>
ForceType application/x-javascript
</Files>
</IfModule>
<IfModule mod_deflate.c>
<IfModule mod_setenvif.c>
SetEnvIfNoCase Request_URI \.gzip$ no-gzip
</IfModule>
</IfModule>
<IfModule mod_headers.c>
Header set X-Powered-By "W3 Total Cache/0.9.1.3"
Header set Vary "Accept-Encoding"
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /wp-content/w3tc/min/
RewriteCond %{HTTP:Accept-Encoding} gzip
RewriteRule .* - [E=APPEND_EXT:.gzip]
RewriteCond %{REQUEST_FILENAME}%{ENV:APPEND_EXT} -f
RewriteRule (.*) $1%{ENV:APPEND_EXT} [L]
RewriteRule ^([a-f0-9]+)\/(.+)\.(include(\-(footer|body))?(-nb)?)\.[0-9]+\.(css|js)$ index.php?tt=$1&gg=$2&g=$3&t=$7 [L]
</IfModule>
# END W3TC Minify
</Directory>
/var/www/domain.com/.htaccess
<Directory /var/www/domain.com>
AddHandler php5-script .php
ExpiresActive on
ExpiresDefault A0
php_flag display_errors on
php_value error_reporting 7
<FilesMatch "\.(inc|class)$">
SetHandler application/x-httpd-php
</FilesMatch>
Options +FollowSymLinks
php_value session.cache_expire 10800
php_value session.gc_maxlifetime 10800
php_value session.gc_probability 1000
php_value session.gc_divisor 100
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !(www.domain.com)$ [NC]
RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301,NC,L]
RewriteCond %{QUERY_STRING} ^sport=(.*)&conference=(.*)&school=(.*)&player=(.*)$
RewriteRule ^player-profile-new\.php$ /%1/%2/%3/%4? [R=301,NC,L]
RewriteRule ^([^-]*)-photos-([^/]*)-((foot|basket)(ball))-([^/]*)?-((p)[0-9]+)(/)?$ /playerimage.php?images=yes&sport=$3&conference=$6&school=$2&player=$7 [NC,L]
RewriteRule ^store/([^/]*)(/)?$ store-$1 [R=301,L]
RewriteRule ^store-([^/]*)(/)?$ /oneproduct.php?productid=$1&oneproduct=true [NC,L]
RewriteRule ^schedule-((foot|basket)(ball))-([^/]*)(/)?$ /schedule.php?sport=$1&school=$4&schedule=true [NC,L]
RewriteRule ^search(/(.*))?$ /search-results?q=$2 [NC,L]
RewriteRule ^((foot|basket)(ball))-([^/]*)-([^/]*)-([^/]*)?-((p)[0-9]+)/edit/deleteimage/([0-9]+)(/)?$ /$6-$5-$1-$4-$7/edit/deleteimage/$9 [R=301,L]
RewriteRule ^((foot|basket)(ball))-([^/]*)-([^/]*)-([^/]*)?-((p)[0-9]+)/(edit)(/)?$ /$6-$5-$1-$4-$7/edit [R=301,L]
RewriteRule ^((foot|basket)(ball))-([^/]*)-([^/]*)-([^/]*)?-((p)[0-9]+)(/)?$ /$6-$5-$1-$4-$7 [R=301,L]
RewriteRule ^((foot|basket)(ball))/([^/]*)/([^/]*)/([^/]*)/?((p)[0-9]+)/edit/deleteimage/([0-9]+)(/)?$ /$6-$5-$1-$4-$7/edit/deleteimage/$9 [R=301,L]
RewriteRule ^((foot|basket)(ball))/([^/]*)/([^/]*)/([^/]*)/?((p)[0-9]+)/(edit)(/)?$ /$6-$5-$1-$4-$7/edit [R=301,L]
RewriteRule ^((foot|basket)(ball))/([^/]*)/([^/]*)/([^/]*)/?((p)[0-9]+)(/)?$ /$6-$5-$1-$4-$7 [R=301,L]
RewriteRule ^((foot|basket)(ball))/([^/]*)/([^/]*)/([^/]*/)?((p)[0-9]+)/edit/deleteimage/([0-9]+)(/)?$ /player-profile?formmode=edit&sport=$1&conference=$4&school=$5&player=$7&deleteimage=1&imageid=$9 [NC,L]
RewriteRule ^((foot|basket)(ball))/([^/]*)/([^/]*)/([^/]*/)?((p)[0-9]+)/(edit)(/)?$ /player-profile?formmode=edit&sport=$1&conference=$4&school=$5&player=$7 [NC,L]
RewriteRule ^((foot|basket)(ball))/([^/]*)/([^/]*)/([^/]*/)?((p)[0-9]+)(/)?$ /player-profile?formmode=view&sport=$1&conference=$4&school=$5&player=$7 [R=301,NC,L]
RewriteRule ^([^/]*)-([^/]*)-((foot|basket)(ball))-([^/]*)?-((p)[0-9]+)/edit/deleteimage/([0-9]+)(/)?$ /player-profile?formmode=edit&sport=$3&conference=$6&school=$2&player=$7&deleteimage=1&imageid=$9 [NC,L]
RewriteRule ^([^/]*)-([^/]*)-((foot|basket)(ball))-([^/]*)?-((p)[0-9]+)/(edit)(/)?$ /player-profile?formmode=edit&sport=$3&conference=$6&school=$2&player=$7 [NC,L]
RewriteRule ^([^/]*)-([^/]*)-((foot|basket)(ball))-([^/]*)?-((p)[0-9]+)(/)?$ /player-profile?formmode=view&sport=$3&conference=$6&school=$2&player=$7&name=$1 [NC,L]
RewriteRule ^([^-]*)-([^-]*)-((foot|basket)(ball))-schedule(/)?$ /yearschedule.php?sport=$3&school=$1&year=$2&schedule=true [NC,L]
RewriteRule ^directory/((foot|basket)(ball))/([^/]*)/([^/]*)(/([^/]*)(/)?)?$ /$5-$1-$4-directory/$7 [R=301,NC,L]
RewriteRule ^([^/]*)-((foot|basket)(ball))-([^/]*)-directory(/)?$ /seoteam?sport=$2&conference=$5&school=$1&sort=$7&seo=yes [NC,L]
RewriteRule ^((foot|basket)(ball))/([^/]*)/([^/]*)/$ /$5-$1-$4/ [R=301,NC,L]
RewriteRule ^([^/]*)-((foot|basket)(ball))-([^/]*)/$ /team?sport=$2&conference=$5&school=$1 [NC,L]
# --
# where the error is occurring - this rewrites happens before the wordpress rewrites and we want the wordpress rewrites to happen first.
# --
RewriteRule ^((foot|basket)(ball))/([^/]*)/([^/]*)(/([^/]*)(/)?)?$ /$5-$1-$4/$7/ [R=301,NC,L]
RewriteRule ^([^/]*)-((foot|basket)(ball))-([^/]*)/([^/]*)/$ /team?sport=$2&conference=$5&school=$1&sort=$6 [NC,L]
RewriteRule ^((foot|basket)(ball))/([^/]*)/([^/]*)$ /team?sport=$1&conference=$4&school=$5 [NC,L]
RewriteRule ^((foot|basket)(ball))(/)?$ /directory?sport=$1 [NC,L]
RewriteRule ^directory/((foot|basket)(ball))(/)?$ /directory-$1 [R=301,NC,L]
RewriteRule ^directory-((foot|basket)(ball))(/)?$ /fulldirectory.php?sport=$1&seo=yes [NC,L]
# Add Derick Schaefer 5/4/11
RewriteRule ^([^-]*)-([^-]*)-((foot|(?:[^-]*-)?basket)(ball))-schedule/?$ /yearschedule.php?sport=$3&school=$1&year=$2&schedule=true [NC,L]
RewriteRule ^([^-]*)-([^-]*)-([^-]*)-((foot|(?:[^-]*-)?basket)(ball))-schedule/?$ /yearschedule.php?sport=$4&school=$1&year=$3&schedule=true [NC,L]
# end Derick Schaefer
RewriteRule ^players/([^/]*)$ /player-profile.php?player=$1 [NC,L]
RewriteRule ^images/playerphotos/([^/]*)/([^/]*).jpg$ /playerphoto.php?player=$2&size=$1 [NC,L]
RewriteRule ^images/interviewphotos/([^/]*)/([^/]*).jpg$ /interviewphoto.php?interview=$2&size=$1 [NC,L]
RewriteRule ^images/captcha(.)(.)([0-9]{3}).jpg /validate.php?char=$1&type=$2&cachebuster=$3 [NC,L]
RewriteRule ^featured-interview/((p)[0-9]*)$ /featured-interview.php?playerid=$1 [NC,L]
RewriteRule ^playerpictures/(.*)/(.*)/(.*)/$ /playerpictures.php?playername=$1&id=$2&playerid=$3&ajaxgallery=true&isimage=true [NC,L]
RewriteRule ^links-(.*)/$ /links.php?linkcategoryname=$1 [NC,L]
RewriteRule ^teamstore/(.*)/?$ teamstore-$1 [R=301,L]
RewriteRule ^teamstore-([^/]*)-([^/]*)/$ /teamproduct.php?teamproduct=$1&products=true&teammascot=$2 [NC,L]
RewriteRule ^teamstore-([^/]*)/$ /teamproduct.php?teamproduct=$1&products=true [NC,L]
RewriteRule ^([^/]*)-([^/]*)-store/?$ /teamproductcategory?teamproduct=$1&category=$2 [NC,L]
RewriteRule ^schedules(/)?$ /scheduledirectory.php?scheduledirectory=1 [NC,L]
RewriteRule ^college-merchandise/?$ /merchandisedirectory.php?collegemerchandise=true [NC,L]
</IfModule>
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE image/x-icon
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE text/javascript
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
AddOutputFilterByType DEFLATE text/x-js
AddOutputFilterByType DEFLATE text/ecmascript
AddOutputFilterByType DEFLATE application/ecmascript
AddOutputFilterByType DEFLATE text/vbscript
AddOutputFilterByType DEFLATE text/fluffscript
AddOutputFilterByType DEFLATE image/svg+xml
AddOutputFilterByType DEFLATE application/x-font-ttf
AddOutputFilterByType DEFLATE application/x-font
AddOutputFilterByType DEFLATE font/opentype
AddOutputFilterByType DEFLATE font/otf
AddOutputFilterByType DEFLATE font/ttf
AddOutputFilterByType DEFLATE application/x-font-truetype
AddOutputFilterByType DEFLATE application/x-font-opentype
AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
AddOutputFilterByType DEFLATE application/vnd.oasis.opendocument.formula-template
</IfModule>
# BEGIN W3TC Browser Cache
<IfModule mod_deflate.c>
<IfModule mod_setenvif.c>
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
</IfModule>
<IfModule mod_headers.c>
Header append Vary User-Agent env=!dont-vary
</IfModule>
AddOutputFilterByType DEFLATE text/css application/x-javascript text/html text/richtext image/svg+xml text/plain text/xsd text/xsl text/xml image/x-icon
</IfModule>
<FilesMatch "\.(css|js)$">
FileETag None
<IfModule mod_headers.c>
Header set X-Powered-By "W3 Total Cache/0.9.1.3"
</IfModule>
</FilesMatch>
<FilesMatch "\.(html|htm|rtf|rtx|svg|svgz|txt|xsd|xsl|xml)$">
FileETag None
<IfModule mod_headers.c>
Header set X-Powered-By "W3 Total Cache/0.9.1.3"
</IfModule>
</FilesMatch>
<FilesMatch "\.(asf|asx|wax|wmv|wmx|avi|bmp|class|divx|doc|docx|exe|gif|gz|gzip|ico|jpg|jpeg|jpe|mdb|mid|midi|mov|qt|mp3|m4a|mp4|m4v|mpeg|mpg|mpe|mpp|odb|odc|odf|odg|odp|ods|odt|ogg|pdf|png|pot|pps|ppt|pptx|ra|ram|swf|tar|tif|tiff|wav|wma|wri|xla|xls|xlsx|xlt|xlw|zip)$">
FileETag None
<IfModule mod_headers.c>
Header set X-Powered-By "W3 Total Cache/0.9.1.3"
</IfModule>
</FilesMatch>
# END W3TC Browser Cache
# BEGIN W3TC Page Cache
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_USER_AGENT} (2\.0\ mmp|240x320|alcatel|amoi|asus|au\-mic|audiovox|avantgo|benq|bird|blackberry|blazer|cdm|cellphone|danger|ddipocket|docomo|dopod|elaine/3\.0|ericsson|eudoraweb|fly|haier|hiptop|hp\.ipaq|htc|huawei|i\-mobile|iemobile|j\-phone|kddi|konka|kwc|kyocera/wx310k|lenovo|lg|lg/u990|lge\ vx|midp|midp\-2\.0|mmef20|mmp|mobilephone|mot\-v|motorola|netfront|newgen|newt|nintendo\ ds|nintendo\ wii|nitro|nokia|novarra|o2|openweb|opera\ mobi|opera\.mobi|palm|panasonic|pantech|pdxgw|pg|philips|phone|playstation\ portable|portalmmm|ppc|proxinet|psp|pt|qtek|sagem|samsung|sanyo|sch|sec|sendo|sgh|sharp|sharp\-tq\-gx10|small|smartphone|softbank|sonyericsson|sph|symbian|symbian\ os|symbianos|toshiba|treo|ts21i\-10|up\.browser|up\.link|uts|vertu|vodafone|wap|willcome|windows\ ce|windows\.ce|winwap|xda|zte) [NC]
RewriteRule .* - [E=W3TC_UA:_low]
RewriteCond %{HTTP_USER_AGENT} (acer\ s100|android|archos5|blackberry9500|blackberry9530|blackberry9550|cupcake|docomo\ ht\-03a|dream|htc\ hero|htc\ magic|htc_dream|htc_magic|incognito|ipad|iphone|ipod|lg\-gw620|liquid\ build|maemo|mot\-mb200|mot\-mb300|nexus\ one|opera\ mini|samsung\-s8000|series60.*webkit|series60/5\.0|sonyericssone10|sonyericssonu20|sonyericssonx10|t\-mobile\ mytouch\ 3g|t\-mobile\ opal|tattoo|webmate|webos) [NC]
RewriteRule .* - [E=W3TC_UA:_high]
RewriteCond %{HTTPS} =on
RewriteRule .* - [E=W3TC_SSL:_ssl]
RewriteCond %{SERVER_PORT} =443
RewriteRule .* - [E=W3TC_SSL:_ssl]
RewriteCond %{HTTP:Accept-Encoding} gzip
RewriteRule .* - [E=W3TC_ENC:.gzip]
RewriteCond %{REQUEST_METHOD} !=POST
RewriteCond %{QUERY_STRING} =""
RewriteCond %{REQUEST_URI} \/$
RewriteCond %{REQUEST_URI} !(\/wp-admin\/|\/xmlrpc.php|\/wp-(app|cron|login|register|mail)\.php|wp-.*\.php|index\.php) [NC,OR]
RewriteCond %{REQUEST_URI} (wp\-comments\-popup\.php|wp\-links\-opml\.php|wp\-locations\.php) [NC]
RewriteCond %{HTTP_COOKIE} !(comment_author|wp\-postpass|wordpress_\[a\-f0\-9\]\+|wordpress_logged_in) [NC]
RewriteCond "/var/www/domain.com/wp-content/w3tc/pgcache/$1/_index%{ENV:W3TC_UA}%{ENV:W3TC_SSL}.html%{ENV:W3TC_ENC}" -f
RewriteRule (.*) "/wp-content/w3tc/pgcache/$1/_index%{ENV:W3TC_UA}%{ENV:W3TC_SSL}.html%{ENV:W3TC_ENC}" [L]
</IfModule>
# END W3TC Page Cache
# BEGIN WordPress
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress
</Directory>