i use .htaccess to rewrite my url from
/list.php?pat=free&mainCol=maincate&subCol=shoes
to
/maincate/shoes
after rewrite, the ajax next page button is not working anymore. it should load list_pull.php from same folder as list.php
$.post("list_pull.php",{
pageCurrent:pageClick,
pullSubCol:$("#pullSubCol").val()});
and the htaccess is like this
RewriteRule ^([^/.]+)/([^/.]+)$ /list.php?pat=free&mainCol=$1&subCol=$2 [L]
i tried use full path http://www.mydomain.com/list_pull.php - not working i tried creating a folder "maincate" and put listpull.php inside, still not working.
by the way, i have another file same as listpull.php, and it works! the rewrite is like this
RewriteRule ^([^/.]+)$ /mainlist.php?pat=free&mainCol=$1 [L]
dont know if my question is clear enough, been trying to figure it out for 2 days now, still no luck.
thanks in advance for help!!
You have redirected all the params after domain name to
mainlist.php
and the uri string with two/
tolist.php
so i suggest you to add another specific rewrite rule forlist_pull.php
and replace [L] with [QSA]QSA
means that if there's a query string passed with the original URL, it will be appended to the rewrite (olle?p=1
will be rewritten asindex.php?url=olle&p=1
.L
means if the rule matches, don't process any more RewriteRules below this one.Now in your ajax call put url like this
Edit Try htaccess.madewithlove.be to test your rewrite rules below i have attached some test rewrites which works fine for me
1) http://www.example.com/call_ajax to RewriteRule ^call_ajax$ /list_pull.php [QSA]
2) http://www.example.com/call/ajax to RewriteRule ^([^/.]+)/([^/.]+)$ /list.php?pat=free&mainCol=$1&subCol=$2 [QSA]
3) http://www.example.com/call to RewriteRule ^([^/.]+)$ /mainlist.php?pat=free&mainCol=$1 [QSA]
Just add
RewriteCond %{REQUEST_FILENAME} !-f
before RewriteRule