Apache URL Re-writing not functioning properly

前端 未结 12 1493
春和景丽
春和景丽 2021-01-17 21:31

I am trying to use apache-rewrite rule to convert the below URL:

http://localhost/foo/bar/news.php?id=24

Into this

12条回答
  •  不思量自难忘°
    2021-01-17 22:05

    Can you see if this works?

    RewriteEngine On
    RewriteBase /DIRECTORY/AID/
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-l
    ^news/([A-Za-z0-9_]+)$ news.php?id=$1 [QSA,L]
    

    EDIT : Fixed the regex character class definitions.

提交回复
热议问题