Url rewriting 使用mod_rewrite在URL中为目录中的所有文件插入字符串

Url rewriting 使用mod_rewrite在URL中为目录中的所有文件插入字符串,url-rewriting,mod,Url Rewriting,Mod,我希望使用mod_rewrite在特定url中的所有文件的扩展名之前插入一个字符串。例如: example.com/products/this-is-a-product.html 添加以下内容(-cool): example.com/products/this-is-a-product-cool.html 指向/products/目录中的每个URL 谢谢 试试这个: RewriteEngine On RewriteCond %{REQUEST_URI} \.html$ RewriteRule

我希望使用mod_rewrite在特定url中的所有文件的扩展名之前插入一个字符串。例如:

example.com/products/this-is-a-product.html

添加以下内容(-cool):

example.com/products/this-is-a-product-cool.html

指向/products/目录中的每个URL

谢谢

试试这个:

RewriteEngine On
RewriteCond %{REQUEST_URI}  \.html$ 
RewriteRule ^example.com\/(.+)\.html$   $1-cool.html

对不起,那不行。同样,我只希望它用于/products/目录中的所有文件