2016-04-06 27 views
1

我的網址有問題,當網點出現在網址時它給出了404錯誤。在網址中給點錯誤

網址:http://example.com/Samsung-Galaxy-Mega-5.8

我使用htaccess的一些代碼,但它不能正常工作。

RewriteRule ^([a-zA-Z_\-]+)/?([a-zA-Z0-9\-=&[email protected]\.]*)$ /$1.php?$2 [QSA,L] 

編輯(從評論複製):

RewriteEngine on 
Options -Indexes 
#RewriteCond %{HTTP_HOST} ^([a-z0-9-A-Z_]*).([a-z]*)$ 
#RewriteRule ^(.*)$ %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 
+0

我們展示更多的你[的.htaccess。這本身就是在尋找'/?',這在你給的例子中不存在。 –

+0

這裏是我的htaccess全碼:上RewriteEngine敘述 選項-Indexes #RewriteCond%{HTTP_HOST} ^([A-Z0-9-A-Z _] *)([AZ] *)$ #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 –

回答

0

我想下面應該讓你去:

^([a-z0-9\-\.]+)\-([a-z0-9\-\.]+)$i 

(基於註釋的.htaccess)

https://regex101.com/r/jZ9sP3/1

你沒有允許的時間段,你沒有逃避連鎖之間的捕捉規則。

拖尾i是區分大小寫的,所以你不需要做a-zA-Z