简体   繁体   中英

All pages Redirecting to one page .htaccess

I am getting problem with .htaccess ... all my pages are getting redirect to one page

here is my .htaccess

EDITED

 <FilesMatch "\.(html|css|js|gif|jpg|jpeg|png|ico|swf)$">
    Header set Cache-Control "max-age=29030400, proxy-revalidate"
</FilesMatch>
<ifmodule mod_deflate.c>
    <filesmatch \.(css|html|js|php|xml)$>
        setoutputfilter deflate
    </filesmatch>
</ifmodule>
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
    RewriteRule ^(.*)$ http://%1%{REQUEST_URI} [R=301,QSA,NC,L]
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^about-trust(.*)$ /trust_detail.php?id=no$1 [L]
    RewriteRule ^college(.*)$ /gallery.php?type=college$1 [L]
    RewriteRule ^trust(.*)$ /gallery.php?type=trust$1 [L]
    RewriteRule ^academy(.*)$ /gallery.php?type=academy$1 [L]
    RewriteRule ^press(.*)$ /gallery.php?type=press$1 [L]


</IfModule>

all my pages are getting redirect to gallery.php like if i try to open trust_detail.php its also getting redirect to gallery.php

You're getting this problem because you're not using L (Last) flag. Change your code to:

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

RewriteCond %{REQUEST_FILENAME} !-d [OR]
RewriteCond %{REQUEST_FILENAME} !-f [OR]
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^ - [L]

RewriteRule ^about-trust(.*)$ /trust_detail.php?id=no$1 [L,QSA]

RewriteRule ^college(.*)$ /gallery.php?type=college$1 [L,QSA]

RewriteRule ^trust(.*)$ /gallery.php?type=trust$1 [L,QSA]

RewriteRule ^academy(.*)$ /gallery.php?type=academy$1 [L,QSA]

RewriteRule ^press(.*)$ /gallery.php?type=press$1 [L,QSA]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM