2014-02-28 2 views
0

나는 다음과 같은 htaccess로 코드가 있습니다htacces은 URL이 작동하지 다시

:

Options +FollowSymlinks 
# Prevent Directoy listing 
Options -Indexes 
# Prevent Direct Access to files 
<FilesMatch "\.(tpl|ini|log)"> 
Order deny,allow 
Deny from all 
</FilesMatch> 

# SEO URL Settings 
RewriteEngine On 
RewriteRule ^products/(.*)/(.*)$ product_details.php?id=$1&name=$2 [L,QSA] 

내 페이지 product_details.php에 나열된 제품이 index.php에 같은 링크를 통해 참조하는 개인 페이지입니다 내가 다시 쓰기 규칙에 다른 기술을 여러 번 시도 http://www.imprimanteetichete.ro/product_details.php?id=1&name=imprimanta-de-etichete-zebra-105sl-plus-203dpi

, 그냥 작동하지 않습니다이 결과

<a href="product_details.php?id=<?php echo $prod['product_id']; ?>&name=<?php echo friendlyURL($prod['name']); ?>" 

. 나는 .htaccess에 처음 왔지만, 기본적인 것 같아.

내가 뭘 잘못하고 있니?

+0

시도를 '^ 제품/([0-9] +)/(. *) $'또는'^ 제품/([0-9] +)/([a-zA-Z0-9 \ -_] +) $'이 더 안전 할 수도 있습니다. – Onimusha

+0

전혀 다르지 않지만 여전히 완전한 URL을 보여줍니다. –

+0

아직도 완전한 URL을 표시합니까? URL 또는 리디렉션을 다시 쓰시겠습니까? – Onimusha

답변

0

당신은이 규칙을 가질 수

RewriteEngine On 
RewriteBase/

또는

RewriteBase http://example.com/ 
RewriteRule ^products/([0-9]+)/([a-zA-Z0-9\-_]+)$ product_details.php?id=$1&name=$2 [L,QSA] 
+2

RewriteBase /, 전혀 다른 것은 없습니다 'RewriteBase http : //www.imprimanteetichete .ro /'내부 서버 오류가 발생합니다. –

0

을 변경하려고 :

RewriteEngine On 

RewriteCond %{THE_REQUEST} \s/+product_details\.php\?id=([^\s&]+)&name=([^\s&]+) [NC] 
RewriteRule^/products/%1/%2? [R=301,L,NE] 

RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteRule ^products/([^/]+)/([^/]+)/?$ /product_details.php?id=$1&name=$2 [L,QSA] 
관련 문제