Question

I have the following URL on my localhost:

http://localhost/?cmd=causeListByCourtName 
http://localhost/?cmd=here could be any other page name

I have tried to rewrite the URL like =

http://localhost/page/causeListByCourtName

I have tried this:

RewriteEngine On
RewriteRule   ^pages/(.+)/?$   .+/?cmd=$1   [NC,L]    
# Handle pages requests

But it do nothing. I am using XAMPP on my windows 7. in my httpd.conf :

LoadModule rewrite_module modules/mod_rewrite.so

is already enabled. What I am doing wrong?

Était-ce utile?

La solution

You need to also make sure you changed AllowOverride None to AllowOverride All in your httpd.conf file wherever you find it.

Try doing it this way.

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

Autres conseils

Options +FollowSymlinks
RewriteEngine on

RewriteRule ^page/(.*)$ index.php?cmd=$1 [L]

This in case you use index.php as your default page. You can cut down the index.php from the front

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top