redirect all but one single page

Discussion in 'Apache' started by Abh, Nov 2, 2010.

  1. #1
    Hello,

    i have this online shop that does some 301 to remove the www and to redirect index.php to root.

    Problem is one of my modules doesn't work, as it need to run a form.php dependent on the product page the form is in. So the link will look like this
    /modules/cereoferta/cereoferta-form.php?id_product=129
    but i get 301 redirected to the product page of id_product=129 before the scrip has time to send the mail.

    I've tried some methods to avoid this, but i can't figure it out.

    My .htaccess:
    # .htaccess automaticaly generated by PrestaShop e-commerce open-source solution
    # http://www.prestashop.com - http://www.prestashop.com/forums
    
    # URL rewriting module activation
    RewriteEngine on
    
    # URL rewriting rules
    
    RewriteRule ^([a-z0-9]+)\-([a-z0-9]+)(\-[_a-zA-Z0-9-]*)/([_a-zA-Z0-9-]*)\.jpg$ /img/p/$1-$2$3.jpg [L,E]
    RewriteRule ^([0-9]+)\-([0-9]+)/([_a-zA-Z0-9-]*)\.jpg$ /img/p/$1-$2.jpg [L,E]
    RewriteRule ^([0-9]+)(\-[_a-zA-Z0-9-]*)/([_a-zA-Z0-9-]*)\.jpg$ /img/c/$1$2.jpg [L,E]
    RewriteRule ^lang-([a-z]{2})/([a-zA-Z0-9-]*)/([0-9]+)\-([a-zA-Z0-9-]*)\.html(.*)$ /product.php?id_product=$3&isolang=$1$5 [L,E]
    RewriteRule ^lang-([a-z]{2})/([0-9]+)\-([a-zA-Z0-9-]*)\.html(.*)$ /product.php?id_product=$2&isolang=$1$4 [L,E]
    RewriteRule ^lang-([a-z]{2})/([0-9]+)\-([a-zA-Z0-9-]*)(.*)$ /category.php?id_category=$2&isolang=$1 [QSA,L,E]
    RewriteRule ^([a-zA-Z0-9-]*)/([0-9]+)\-([a-zA-Z0-9-]*)\.html(.*)$ /product.php?id_product=$2$4 [L,E]
    RewriteRule ^([0-9]+)\-([a-zA-Z0-9-]*)\.html(.*)$ /product.php?id_product=$1$3 [L,E]
    RewriteRule ^([0-9]+)\-([a-zA-Z0-9-]*)(.*)$ /category.php?id_category=$1 [QSA,L,E]
    RewriteRule ^content/([0-9]+)\-([a-zA-Z0-9-]*)(.*)$ /cms.php?id_cms=$1 [QSA,L,E]
    RewriteRule ^([0-9]+)__([a-zA-Z0-9-]*)(.*)$ /supplier.php?id_supplier=$1$3 [QSA,L,E]
    RewriteRule ^([0-9]+)_([a-zA-Z0-9-]*)(.*)$ /manufacturer.php?id_manufacturer=$1$3 [QSA,L,E]
    RewriteRule ^lang-([a-z]{2})/(.*)$ /$2?isolang=$1 [QSA,L,E]
    
    # Catch 404 errors
    ErrorDocument 404 /404.php
    
    
    # To redirect all users to access the site WITHOUT the www. prefix,
    RewriteCond %{HTTP_HOST} ^www\.5com\.ro$ [NC]
    RewriteRule ^(.*)$ http://5com.ro/$1 [L,R=301]
    
    # To redirect index.php to root
    RewriteBase /
    RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/
    RewriteRule ^index\.php$ http://5com.ro/ [R=301,L]
    
    # Turn on Expires and set default to 0
    ExpiresActive On
    ExpiresDefault A0
     
    # Set up caching on media files for 1 year (forever?)
    <FilesMatch "\.(flv|ico|pdf|avi|mov|ppt|doc|mp3|wmv|wav)$">
    ExpiresDefault A29030400
    Header append Cache-Control "public"
    </FilesMatch>
     
    # Set up caching on media files for 1 week
    <FilesMatch "\.(gif|jpg|jpeg|png|swf)$">
    ExpiresDefault A604800
    Header append Cache-Control "public"
    </FilesMatch>
     
    # Set up 2 Hour caching on commonly updated files
    <FilesMatch "\.(xml|txt|html|js|css)$">
    ExpiresDefault A997200
    Header append Cache-Control "proxy-revalidate"
    </FilesMatch>
     
    # Force no caching for dynamic files
    <FilesMatch "\.(php|cgi|pl|htm)$">
    ExpiresActive Off
    Header set Cache-Control "private, no-cache, no-store, proxy-revalidate, no-transform"
    Header set Pragma "no-cache"
    </FilesMatch>
    
    Code (markup):
     
    Abh, Nov 2, 2010 IP