I want to know how to rewrite the url in linux server through .htaccess
We are using “front/” in the URL that is visible to the public: http://www.iict.com/front/property/property_detail.php?pid=12? I want to remove all details from the URLs that don’t need to be there (e.g.“front/property”). This should be: http://ww开发者_Go百科w.iict.com/property_detail.php?pid-12.
Please help me on this issue. I am using Linux-based server
for http://www.iict.com/property_detail/12
make a file called anything.htaccess.txt then place the lines below in it
RewriteEngine On
RewriteRule ^property_detail/([a-zA-Z0-9\-]+)$ front/property/property_detail.php?pid=$1
upload to your hosting, then rename the file too ".htaccess"
You're better off doing this at the web server level - for instance, if you're using Apache, use mod_rewrite.
You could then make the URLs even cleaner, for instance: http://www.iict.com/property/12.
If you specify which server software you're using, someone could probably provide an example, or at least point you to the appropriate docs.
EDIT: Apache's mod_rewrite docs are at http://httpd.apache.org/docs/current/mod/mod_rewrite.html - if you're using Apache, that will be a useful read.
This is not rewrite in php.
This is rewrite in your web server, what web server your have?
精彩评论