Domanda

I am working on XAMPP V.3.2.1 on Windows 8.1 64-bit.

I have the following code in my .htaccess file:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)/?$ /?cmd=$1 [NC,L]

Now, when i write link like

http://localhost/aboutUs
http://localhost/MyAnyOtherPage

it works fine even if i use form in the page with post back method, but when i try to use links with two parameters and i change my .htaccess file link like this:

 RewriteEngine On
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteCond %{REQUEST_FILENAME} !-d
 RewriteRule ^(.+)/?$ /?cmd=$1&caseSno=$2 [NC,L]

In this way i am accessing my page by cmd and searching database record with caseSno parameters.

To achieve this how can i write my hard coded links to run my page with searching database tables and pitch records with second parameter caseSno? This is not working for me:

My Original link is :

localhost/?cmd=caseDetailsByCaseSno&caseSno=2308

How to write this? The following is not working for me?

http://localhost/caseInformation/case/234

Thanks in advance

È stato utile?

Soluzione

This should help you with two parameters.

If you have this URL http://localhost/caseDetailsByCaseSno/234 then you should be able to use this htaccess.

 RewriteEngine On
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteCond %{REQUEST_FILENAME} !-d
 RewriteRule ^([^/]+)/([^/]+)/?$ /?cmd=$1&caseSno=$2 [NC,L]

 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteCond %{REQUEST_FILENAME} !-d
 RewriteRule ^(.+)/?$ /?cmd=$1 [NC,L]
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top