【发布时间】:2017-04-04 22:59:02
【问题描述】:
我需要一些 .htaccess 文件和 URL 重写方面的帮助。我在这里搜索了所有问题和答案,我坚持下去。
因此,我需要帮助将空格 %20 替换为 - 以创建对 SEO 友好的 URL。
当前网址http://localhost/blog/Blog%20of%20the%20day
这是我的 .htaccess 文件
RewriteEngine On
# Removes .php extension from inner_blog.php
RewriteRule ^blog/?$ blog.php [NC]
# Remove inner_blog.php and changing it to blog/articlename
RewriteRule ^blog/([^/]*)$ /inner_blog.php?title=$1 [L]
# Need to replace %20 with - from URL
# Current URL http://localhost/blog/Blog%20of%20the%20day
# Need to be http://localhost/blog/Blog-of-the-day
# Was like http://localhost/inner_blog.php?title=Blog%20of%20the%20day
【问题讨论】:
标签: php apache .htaccess mod-rewrite