problem .htaccess not work
i write .htaccess in folder directory and run my site but nothing happend in url
example
index.php and add link to showpage.php?id=14
i want to change to products/14
Options +FollowSymLinks
RewriteEngine On
# Turn on the rewriting engi开发者_如何学编程ne
RewriteRule ^products/([0-9]+)/?$ showpage.php?id=$1 [NC,L]
# Handle product requests
.htaccess will not magically rewrite links you've already added to your code. It's simply a tool for Apache to handle incoming requests.
In your index.php
file, change the link from showpage.php?id=14
to products/14
. Reload the page in your browser. Provided that the rule is correctly set up (it looks correct), clicking the link should show the right URL in the address bar, and the right page content as well.
The .htaccess must be enabled to function. In the apache config AllowOverwrite rewrite must be enabled. A short example
<Directory /foo/bar/>
AllowOverride All
</Directory>
精彩评论