How to change URL? htaccess

前端 未结 2 1833
感情败类
感情败类 2021-01-25 05:01

What I have

newsy/czytaj/items/odbierz-250zl-na-reklame.html

This is what I would have

newsy/odbierz-250zl-na-reklame.html

2条回答
  •  情歌与酒
    2021-01-25 05:37

    In principle you just create a corresponding rewrite rule:

    RewriteRule ^newsy/czytaj/items/(.+) /newsy/$1 [L]
    

    It is crucial not to omit [L]flag. Otherwise your rewrite engine may get stuck in an endless loop. Also in the beginning of the .htaccessfile remember to enable mod_rewrite with:

    RewriteEngine On
    

    For more help on mod_rewrite, I recommend checking out mod_rewrite-cheatsheet. For an exhaustive URl Rewriting Guide see a corresponding page from Apache 2.0 Documentation.

提交回复
热议问题