Htaccess page with a new line

I recently tried to hide the parameters from my url using htaccess, resulting in a 500 Server Error.

Here is my code .htaccess:

<files .htaccess>
    order allow,deny
    deny from all
</files>
Options -Indexes +FollowSymLinks
RewriteEngine on
RewriteBase /
ErrorDocument 404 /404.php
RewriteEngine On    
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{THE_REQUEST} \s(.+?)/+[?\s]
RewriteRule ^(.+?)/$ /$1 [R=301,L]
RewriteBase /
RewriteRule ^([^/]+\.php)/.* $1 [R=301,L]

RewriteRule ^buyit\.php$ /buyit.php?qstart=1&gid=73161-645821-36&qid=4&daq=0&preq=14&clk=7 [L]

All I wanted to do was my buyit.php page? qsta = 1 & gid = 11-64-36 & qid = 4 & kaq = 0 & req = 14 & dlk = 7, to always show how to save buyit.php my variables are intact and convenient for my php scripts. So I added this last line in htaccess, but unfortunately it worked.

Any ideas why please?

+4
source share
2 answers

Your code is looping. This is because you cannot match the query string in the rewrite rule, thus the URL is:

/buyit.php?qstart=1&gid=73161-645821-36&qid=4&daq=0&preq=14&clk=7 

really matches:

^buyit\.php$

, , , . :

RewriteCond %{QUERY_STRING} ^$
RewriteRule ^buyit\.php$ /buyit.php?qstart=1&gid=73161-645821-36&qid=4&daq=0&preq=14&clk=7 [L]
+2

, GET, . , URL , .

htaccess.

RewriteRule ^([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)\.html$ /buyit.php?qsta=$1&gid=$2&qid=$3&kaq=$4&req=$5&dlk=$6 [L]

URL :

 http://yourdomain.com/buyit.php?qsta=1&gid=11-64-36&qid=4&kaq=0&req=14&dlk=7

http://ydomain.com/1/11-64-36/4/0/14/7.html

SEO.

+1

All Articles