HTAccess rewrite dynamic page url

2019-07-29 12:13发布

thanks for your help in advance

Basically i have made a dynamic url website http://planet-dj-surrey.com/

I cant seem to figure out the code for the htaccess file to redirect a dynamic page and make it cleaner.

for example i want http://planet-dj-surrey.com/index.php?page=designprocess to be changed to

http://planet-dj-surrey.com/designprocess/

currently i have this but it does not seem to be working,

RewriteEngine On
RewriteRule   ^/dropdownchoice/$   index.php?page=dropdownchoice  [NC]

Thanks in advance

2条回答
ゆ 、 Hurt°
2楼-- · 2019-07-29 12:50

You need to lose the leading slash:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/$ index.php?page=$1  [NC]
查看更多
等我变得足够好
3楼-- · 2019-07-29 13:01

Here is a simple example:

Options +FollowSymLinks
RewriteEngine On
RewriteRule ^post-(.*)-([0-9]+)\.html$ post.php?post_name=$1&post_id=$2 [L]
查看更多
登录 后发表回答