Php .htaccess URL以波斯语重写
我已经将一个分类脚本转换为RTL,以便能够将其用于波斯语字符集。除了我的Php .htaccess URL以波斯语重写,php,apache,.htaccess,mod-rewrite,url-rewriting,Php,Apache,.htaccess,Mod Rewrite,Url Rewriting,我已经将一个分类脚本转换为RTL,以便能够将其用于波斯语字符集。除了我的.htaccess没有写我应该在波斯语URL中显示的广告标题之外,一切都很正常。我在.htaccess中包含了一个UTF-8字符集,但仍然没有 当前我的URL如下所示: http://www.domain.com/3/posts/4__/4__/41722__.html 我希望它看起来像这样: http://www.domain.com/3/posts/4__/4__/41722_html 我对PHP和HTML有很好的理解,
.htaccess
没有写我应该在波斯语URL中显示的广告标题之外,一切都很正常。我在.htaccess
中包含了一个UTF-8字符集,但仍然没有
当前我的URL如下所示:
http://www.domain.com/3/posts/4__/4__/41722__.html
我希望它看起来像这样:
http://www.domain.com/3/posts/4__/4__/41722_html
我对PHP和HTML有很好的理解,但我真的不理解整个.htaccess
和URL重写概念。我希望有人能帮我
这是我当前的.htaccess
:
RewriteEngine On
AddDefaultCharset utf-8
# Show ad RewriteRule ^([-]?[0-9]+)([-_][^/]*)?/posts/([0-9]+)([-_][^/]*)?/([0-9]+)([-_][^/]*)?/([0-9]+)([-_][^/]*)?\.html /index.php?view=showad&adid=$7&cityid=$1 [QSA]
# Ads RewriteRule ^([-]?[0-9]+)([-_][^/]*)?/posts/([0-9]+)([-_][^/]*)?/([0-9]+)([-_][^/]*)?/page([0-9]*)\.html /index.php?view=ads&catid=$3&subcatid=$5&cityid=$1&page=$7 [QSA] RewriteRule ^([-]?[0-9]+)([-_][^/]*)?/posts/([0-9]+)([-_][^/]*)?/([0-9]+)([-_][^/]*)? /index.php?view=ads&catid=$3&subcatid=$5&cityid=$1 [QSA]
## Begin Version 5.2 - Pagination bug fix + Uniform page links ##
# Ads by cat RewriteRule ^([-]?[0-9]+)([-_][^/]*)?/posts/([0-9]+)([-_][^/]*)?/page([0-9]*)\.html /index.php?view=ads&catid=$3&subcatid=0&&cityid=$1&page=$5 [L,QSA]
RewriteRule ^([-]?[0-9]+)([-_][^/]*)?/posts/([0-9]+)([-_][^/]*)? /index.php?view=ads&catid=$3&cityid=$1 [QSA]
## End Version 5.2 - Pagination bug fix + Uniform page links ##
# Show event RewriteRule ^([-]?[0-9]+)([-_][^/]*)?/events(/(([0-9]+)-([0-9]+)-([0-9]+)))?/([0-9]+)([-_][^/]*)?\.html /index.php?view=showevent&date=$4&adid=$8&cityid=$1 [QSA]
# Events on date RewriteRule ^([-]?[0-9]+)([-_][^/]*)?/events/(([0-9]+)-([0-9]+)-([0-9]+))/page([0-9]*)\.html /index.php?view=events&date=$3&cityid=$1&page=$7 [QSA] RewriteRule ^([-]?[0-9]+)([-_][^/]*)?/events/(([0-9]+)-([0-9]+)-([0-9]+)) /index.php?view=events&date=$3&cityid=$1 [QSA] RewriteRule ^([-]?[0-9]+)([-_][^/]*)?/events /index.php?view=events&cityid=$1 [QSA]
# Show image RewriteRule ^([-]?[0-9]+)([-_][^/]*)?/images/([^/]+)/([0-9]+)([-_][^/]*)?\.html /index.php?view=showimg&posterenc=$3&imgid=$4&cityid=$1 [QSA]
# Images by user, paged RewriteRule ^([-]?[0-9]+)([-_][^/]*)?/images/([^/]+)/page([0-9]+)\.html /index.php?view=imgs&posterenc=$3&cityid=$1&page=$4 [QSA]
# Top Images, paged RewriteRule ^([-]?[0-9]+)([-_][^/]*)?/images/page([0-9]+)\.html /index.php?view=imgs&cityid=$1&page=$3 [QSA]
# Images by user RewriteRule ^([-]?[0-9]+)([-_][^/]*)?/images/([^/]+) /index.php?view=imgs&posterenc=$3&cityid=$1 [QSA]
# Top Images RewriteRule ^([-]?[0-9]+)([-_][^/]*)?/images /index.php?view=imgs&cityid=$1 [QSA]
# Quick ad/event/image RewriteRule ^([-]?[0-9]+)([-_][^/]*)?/showpost/([0-9]+)([-_][^/]*)?\.html /index.php?view=showad&adid=$3&cityid=$1 [QSA] RewriteRule ^([-]?[0-9]+)([-_][^/]*)?/showevent/([0-9]+)([-_][^/]*)?\.html /index.php?view=showevent&adid=$3&cityid=$1 [QSA] RewriteRule ^([-]?[0-9]+)([-_][^/]*)?/showimage/([0-9]+)([-_][^/]*)?\.html /index.php?view=showimg&imgid=$3&cityid=$1 [QSA]
# City/Region RewriteRule ^([-]?[0-9]+)([-_][^/]*)? /index.php?view=main&cityid=$1 [QSA] RewriteRule ^([-]?[0-9]+)([-_][^/]*)? /index.php?view=main&cityid=$1 [QSA]
比如说
http://localhost/aaraad/fa/1489820252460/html
:
RewriteRule ^([A-Za-z0-9-_]+)/([0-9-_]+)/(.+?).html/?$ ?lan=$1&id=$2&title=$3 [NC,L]
匹配任何字符:(.+?)
例如
http://localhost/aaraad/fa/1489820252460/html
:
RewriteRule ^([A-Za-z0-9-_]+)/([0-9-_]+)/(.+?).html/?$ ?lan=$1&id=$2&title=$3 [NC,L]
匹配任意字符:(.+?)