In my website there is a link to registered tutors. That link is something like this
http://www.lankainstitute.com/profiles/centers/index.php?code=1203&institute=Montana+Higher+Educational+Institute#page=art-section
So I need to rewrite this link and after rewrite it want to display in my browser's address bar something like this:
www.lankainstitute.com/1203/Montana-Higher-Educational-Institute
Can anybody tell me is it possible to rewrite above original URL to my expected URL and can display it in address bar?
Thank you..
是的,您可以通过在 .htaccess 文件中添加一行来实现。
Depending on the server (Apache, ISS) there are tool to do so. Like in Apache mod_rewrite, look for some sample rewrite rules.
for example
DocumentRoot /var/www/example.com
Alias /myapp /opt/myapp-1.2.3
<Directory /opt/myapp-1.2.3>
RewriteEngine On
RewriteBase /myapp/
RewriteRule ^index\.html$ welcome.html
</Directory>
learn more to use htaccess for url rewriting
Well, in this case, you can simply do this:
http://www.lankainstitute.com/profiles/centers/index.php?code=1203&institute=Montana+Higher+Educational+Institute#page=art-section
to www.lankainstitute.com/1203/Montana-Higher-Educational-Institute
Code:
RewriteEngine On
RewriteRule ^([0-9]+)/([a-zA-Z0-9_-]+)$ index.php?code=$1&institute=$2
Add this code in your .htaccess
file
Use your .htaccess file. Look into RewriteEngine
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.