I am new to rewriting URLs.
I wrote a few rewrite rules in the .htaccess file. My problem is that the ajax request and the admin section (both of which are managed by different files named ajax.php and admin.php) do not work at all.
Here is what I am trying to achieve with mod-rewrite:
URL: http://websitename/index.php?page=rr&cn=abc&cid=1
should look like this: http://websitename/rr/abc/1
in the address bar of the browser
and
URL (having only the value "page"): http://websitename/index.php?page=register
should look like this: http://websitename/register
in the address bar of the browser
and
URL: http://websitename/index.php?page=i&in=banking&iid=12
should look like this: http://websitename/industry/banking/12
in the address bar of the browser
and
URL: http://websitename/index.php?page=cr&cn=pqr&rid=12
should look like this: http://websitename/cr/pqr/12
in the address bar of the browser
, , , ajax.php admin.php , ( ).
Options +FollowSymLinks
RewriteEngine on
RewriteRule ^([A-Za-z0-9-]+)/([^/]+)/([^/]+)$ index.php?page=$1&companyname=$2&companyid=$3%{QUERY_STRING} [L,QSA]
RewriteRule ^([^/]+)$ index.php?page=$1%{QUERY_STRING} [L,QSA]
RewriteRule ^view/([^/]+)/([^/]+)/([^/]+)$ index.php?page=$1&industryname=$2&industryid=$3%{QUERY_STRING} [L,QSA]
RewriteRule ^([^/]*)/([^/]*)/review/([^/]*)$ /index.php?page=$1&companyname=$2&reviewid=$3 [L]
mod-rewrite , ajax, "ajax.php", ( )
. URL- mod-rewrite
http://websitename/ajax.php?action=vote
http://websitename/admin.php?page=home
( ajax.php admin.php)
ajax.php admin.php
, . .