简体   繁体   中英

How do I rewrite my URLS with .htaccess and mod_rewrite?

I currently have my URLS in this format:

http://www.domain.com/game.php?id=3434&title=title-goes-here

I would like the URLs to be written as:

http://www.domain.com/ID/title-goes-here.html

How would I go about doing this?

Try this:

Create an .htaccess file in the root of your website and put this in it.

RewriteEngine On
RewriteRule ^([^/]*)/([^/]*)\.html$ /game.php?id=$1&title=$2 [L]

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM