Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/url/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/apache-kafka/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.htaccess url中的点表示错误_.htaccess_Url_Redirect - Fatal编程技术网

.htaccess url中的点表示错误

.htaccess url中的点表示错误,.htaccess,url,redirect,.htaccess,Url,Redirect,当我的url中出现一个点时,我收到一个404错误,例如:http://example.com/Samsung-Galaxy-Mega-5.8 以下是我的整个htaccess代码: RewriteEngine on Options -Indexes #RewriteCond %{HTTP_HOST} ^([a-z0-9-A-Z_]*).([a-z]*)$ #RewriteRule ^(.*)$ http://www.%1.%2/$1 [L,R=301] RewriteCond %{REQUES

当我的url中出现一个点时,我收到一个404错误,例如:
http://example.com/Samsung-Galaxy-Mega-5.8

以下是我的整个htaccess代码:

RewriteEngine on
Options -Indexes

#RewriteCond %{HTTP_HOST} ^([a-z0-9-A-Z_]*).([a-z]*)$
#RewriteRule ^(.*)$ http://www.%1.%2/$1 [L,R=301]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
#RewriteRule ^([a-zA-Z0-9_-]+)$ show_mobile.php?bid=$1&brandname=$2
RewriteRule ^([a-zA-Z0-9\-]+)-([a-zA-Z0-9\-]+)$ show_mobile.php?bid=$2&brandname=$1

请帮助我,我搜索了很多问题,但没有找到任何有用的正确答案。

调整正则表达式,在第一个连字符后允许

Options -Indexes
RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([a-zA-Z0-9-]+)-([\w.-]+)/?$ show_mobile.php?bid=$2&brandname=$1 [L,QSA]