用htaccess重定向问题

时间:2015-07-06 14:57:02

标签: php .htaccess mod-rewrite redirect

我一直在努力处理我的IP地址。我的域名类似于这个www.example.com,如果我输入并进入网站它运作良好,但当我输入我的域名ip 120.30.11.140(示例)地址时,它给我错误 - gi-sys / defaultwebpage。 cgi我想是因为我的开发人员编写了一些htacess代码,我认为这会导致IP地址重新编写。是否可能使用htaccess代码导致IP地址出现问题?我需要IP地址来重定向我的域名

这是我的htaccess文件,我用example.com更改了实际的网站名称

Options +FollowSymLinks
RewriteEngine On

RewriteCond %{HTTP_HOST} !^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]


RewriteRule about-us.html index.php?p=2 [L]
RewriteRule products.html index.php?p=3 [L]
RewriteRule windows-doors.html index.php?p=6 [L]
RewriteRule fly-screens.html index.php?p=8 [L]
RewriteRule colour-range.html index.php?p=34 [L]
RewriteRule benefits.html index.php?p=22 [L]
RewriteRule gallery.html index.php?p=30 [L]
RewriteRule certificates.html index.php?p=31 [L]
RewriteRule contact-us.html index.php?p=5 [L]
RewriteRule quote.html index.php?p=24 [L]





RewriteRule tilt-turn-windows-doors.php index.php?p=9 [L]
RewriteRule tilt-slide-windows-doors.php index.php?p=10 [L]
RewriteRule sliding-windows-doors.html index.php?p=11 [L]
RewriteRule lift-slide-doors.html index.php?p=29 [L]
RewriteRule bi-fold-windows-doors.php index.php?p=33 [L]
RewriteRule french-windows-doors.php index.php?p=12 [L]
RewriteRule casement-windows-doors.html index.php?p=13 [L]
RewriteRule awning-windows.html index.php?p=14 [L]
RewriteRule tilt-windows.html index.php?p=15 [L]
RewriteRule sitemap.html index.php?p=32 [L]
RewriteRule doors.html index.php?p=7 [L]

RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\?p=1\ HTTP  
RewriteRule ^index\.php$ http://www.example.com.au/? [R=301,L]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\?p=2\ HTTP  
RewriteRule ^index\.php$ http://www.example.com.au/about-us.html? [R=301,L]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\?p=3\ HTTP  
RewriteRule ^index\.php$ http://www.example.com.au/products.html? [R=301,L]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\?p=6\ HTTP  
RewriteRule ^index\.php$ http://www.example.com.au/windows-doors.html? [R=301,L]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\?p=8\ HTTP  
RewriteRule ^index\.php$ http://www.example.com.au/fly-screens.html? [R=301,L]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\?p=34\ HTTP 
RewriteRule ^index\.php$ http://www.example.com.au/colour-range.html? [R=301,L]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\?p=22\ HTTP 
RewriteRule ^index\.php$ http://www.example.com.au/benefits.html? [R=301,L]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\?p=30\ HTTP 
RewriteRule ^index\.php$ http://www.example.com.au/gallery.html? [R=301,L]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\?p=31\ HTTP 
RewriteRule ^index\.php$ http://www.example.com.au/certificates.html? [R=301,L]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\?p=5\ HTTP  
RewriteRule ^index\.php$ http://www.example.com.au/contact-us.html? [R=301,L]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\?p=24\ HTTP 
RewriteRule ^index\.php$ http://www.example.com.au/quote.html? [R=301,L]

RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\?p=10\ HTTP 
RewriteRule ^index\.php$ http://www.example.com.au/tilt-slide-windows-doors.php? [R=301,L]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\?p=9\ HTTP  
RewriteRule ^index\.php$ http://www.example.com.au/tilt-turn-windows-doors.php? [R=301,L]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\?p=11\ HTTP 
RewriteRule ^index\.php$ http://www.example.com.au/sliding-windows-doors.html? [R=301,L]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\?p=29\ HTTP 
RewriteRule ^index\.php$ http://www.example.com.au/lift-slide-doors.html? [R=301,L]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\?p=33\ HTTP 
RewriteRule ^index\.php$ http://www.example.com.au/bi-fold-windows-doors.php? [R=301,L]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\?p=12\ HTTP 
RewriteRule ^index\.php$ http://www.example.com.au/french-windows-doors.php? [R=301,L]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\?p=13\ HTTP 
RewriteRule ^index\.php$ http://www.example.com.au/casement-windows-doors.html? [R=301,L]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\?p=14\ HTTP 
RewriteRule ^index\.php$ http://www.example.com.au/awning-windows.html? [R=301,L]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\?p=15\ HTTP 
RewriteRule ^index\.php$ http://www.example.com.au/tilt-windows.html? [R=301,L]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\?p=32\ HTTP 
RewriteRule ^index\.php$ http://www.example.com.au/sitemap.html? [R=301,L]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\?p=7\ HTTP  
RewriteRule ^index\.php$ http://www.example.com.au/doors.html? [R=301,L]


# 301 --- http://www.example.com.au/index.php?p=30&album=5 => http://www.example.com.au/gallery/dandenong-north.php
RewriteCond %{QUERY_STRING} (^|&)p=30($|&)
RewriteCond %{QUERY_STRING} (^|&)album=5($|&)
RewriteRule ^index\.php$ /gallery/dandenong-north.php? [L,R=301]
# Rewrite --- http://www.example.com.au/index.php?p=30&album=5 => http://www.example.com.au/gallery/dandenong-north.php
RewriteCond %{QUERY_STRING} (^|&)p=30($|&)
RewriteCond %{QUERY_STRING} (^|&)album=5($|&)
RewriteRule ^index\.php$ /gallery/dandenong-north.php?&%{QUERY_STRING}


RewriteCond %{QUERY_STRING} (^|&)p=30($|&)
RewriteCond %{QUERY_STRING} (^|&)album=22($|&)
RewriteRule ^index\.php$ /gallery/elwud.php? [L,R=301]

RewriteCond %{QUERY_STRING} (^|&)p=30($|&)
RewriteCond %{QUERY_STRING} (^|&)album=22($|&)
RewriteRule ^index\.php$ /gallery/elwud.php?&%{QUERY_STRING}


RewriteCond %{QUERY_STRING} (^|&)p=30($|&)
RewriteCond %{QUERY_STRING} (^|&)album=1($|&)
RewriteRule ^index\.php$ /gallery/elwood.php? [L,R=301]

RewriteCond %{QUERY_STRING} (^|&)p=30($|&)
RewriteCond %{QUERY_STRING} (^|&)album=1($|&)
RewriteRule ^index\.php$ /gallery/elwood.php?&%{QUERY_STRING}


RewriteCond %{QUERY_STRING} (^|&)p=30($|&)
RewriteCond %{QUERY_STRING} (^|&)album=4($|&)
RewriteRule ^index\.php$ /gallery/elwood-part-2.php? [L,R=301]

RewriteCond %{QUERY_STRING} (^|&)p=30($|&)
RewriteCond %{QUERY_STRING} (^|&)album=4($|&)
RewriteRule ^index\.php$ /gallery/elwood-part-2.php?&%{QUERY_STRING}

RewriteCond %{QUERY_STRING} (^|&)p=30($|&)
RewriteCond %{QUERY_STRING} (^|&)album=7($|&)
RewriteRule ^index\.php$ /gallery/international.php? [L,R=301]

RewriteCond %{QUERY_STRING} (^|&)p=30($|&)
RewriteCond %{QUERY_STRING} (^|&)album=7($|&)
RewriteRule ^index\.php$ /gallery/international.php?&%{QUERY_STRING}

RewriteCond %{QUERY_STRING} (^|&)p=30($|&)
RewriteCond %{QUERY_STRING} (^|&)album=6($|&)
RewriteRule ^index\.php$ /gallery/werribee.php? [L,R=301]

RewriteCond %{QUERY_STRING} (^|&)p=30($|&)
RewriteCond %{QUERY_STRING} (^|&)album=6($|&)
RewriteRule ^index\.php$ /gallery/werribee.php?&%{QUERY_STRING}


RewriteCond %{QUERY_STRING}  ^p=9$ [NC]
RewriteRule ^$ http://www.example.com.au/tilt-turn-windows-doors.php? [R=301,NE,NC,L]
RewriteCond %{QUERY_STRING}  ^p=10$ [NC]
RewriteRule ^$ http://www.example.com.au/tilt-slide-windows-doors.php? [R=301,NE,NC,L]
RewriteCond %{QUERY_STRING}  ^p=33$ [NC]
RewriteRule ^$ http://www.example.com.au/bi-fold-windows-doors.php? [R=301,NE,NC,L]
RewriteCond %{QUERY_STRING}  ^p=12$ [NC]
RewriteRule ^$ http://www.example.com.au/french-windows-doors.php? [R=301,NE,NC,L]
RewriteCond %{QUERY_STRING}  ^p=6$ [NC]
RewriteRule ^$ http://www.example.com.au? [R=301,NE,NC,L]
RewriteCond %{QUERY_STRING}  ^p=7$ [NC]
RewriteRule ^$ http://www.example.com.au? [R=301,NE,NC,L]


redirect 301 /upvc_windows.php http://www.example.com.au
redirect 301 /upvc_doors.php http://www.example.com.au
redirect 301 /windows-doors.html http://www.example.com.au
redirect 301 /doors.html http://www.example.com.au




#RewriteCond %{HTTP_HOST} !^www\.(.*)$ [NC]
#RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]














## EXPIRES CACHING ##
#<IfModule mod_expires.c>
#ExpiresActive On
#ExpiresByType image/jpg "access 1 year"
#ExpiresByType image/jpeg "access 1 year"
#ExpiresByType image/gif "access 1 year"
#ExpiresByType image/png "access 1 year"
#ExpiresByType text/css "access 1 month"
#ExpiresByType text/html "access 1 month"
#ExpiresByType application/pdf "access 1 month"
#ExpiresByType text/x-javascript "access 1 month"
#ExpiresByType application/x-shockwave-flash "access 1 month"
#ExpiresByType image/x-icon "access 1 year"
#ExpiresDefault "access 1 month"
#</IfModule>
## EXPIRES CACHING ##



## EXPIRES CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access 1 year"
ExpiresByType image/jpeg "access 1 year"
ExpiresByType image/gif "access 1 year"
ExpiresByType image/png "access 1 year"
ExpiresByType text/css "access 1 month"
ExpiresByType text/html "access 1 month"
ExpiresByType application/pdf "access 1 month"
ExpiresByType text/x-javascript "access 1 month"
ExpiresByType application/x-shockwave-flash "access 1 month"
ExpiresByType image/x-icon "access 1 year"
ExpiresDefault "access 1 month"
</IfModule>
## EXPIRES CACHING ##

<IfModule mod_deflate.c>
# Insert filters
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
AddOutputFilterByType DEFLATE application/x-httpd-php
AddOutputFilterByType DEFLATE application/x-httpd-fastphp
AddOutputFilterByType DEFLATE image/svg+xml

# Drop problematic browsers
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html

# Make sure proxies don't deliver the wrong content
Header append Vary User-Agent env=!dont-vary
</IfModule>

0 个答案:

没有答案