CodeIgniter Query String Rewrite in .htaccess

后端 未结 1 1800
青春惊慌失措
青春惊慌失措 2021-01-22 08:38

When I first launched my site, URLs were in the following format:

project.php?projectID=1&pageID=2

A few years ago I modified my .htaccess

1条回答
  •  清歌不尽
    2021-01-22 08:57

    You need to match against the request and not the URI. The URI won't have any of the query string in it:

    RewriteCond %{THE_REQUEST} \ /+project\.php\?projectID=([0-9]+)(?:&pageID=([0-9]+)|)
    RewriteRule ^ /project/%1/%2? [L,R=301]
    
    RewriteCond $1 !^(index\.php)
    RewriteRule ^(.*)$ index.php/$1 [L]
    

    0 讨论(0)
提交回复
热议问题