2012-10-31 4 views
0

에 내 htaccess로 꽤 URL이 작동하지 않는 내가 URL을 다시 작성해야 내 XAMPP의 로컬 호스트에 http://localhost/blog/post/48http://localhost/blog/post.php?id=48 합니다. .htaccess 파일을 만들고 아래 코드를 작성했습니다.로컬 호스트 (XAMPP와 로컬 컴퓨터)

<IfModule mod_rewrite.c> 
RewriteEngine On 
RewriteBase/
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^post/([0-9]+)/?$ post.php?id=$1 [NC,L] 
</IfModule> 

리디렉션과 다른 모든 것들을 시도했습니다. 모든 것이 작동하지만 재 작성 규칙만으로는 작동하지 않습니다. 나는 모든 옵션을 검색하고 시도했지만 성공하지 못했습니다. Plz 사람이 날 도와!

+0

오염되지 않는 태그를. 귀하의 질문은 PHP와 전혀 관련이 없습니다. 태그가 제거되었습니다. –

답변

0

마지막으로 그 아래의 코드 작업 :

<IfModule mod_rewrite.c> 
RewriteEngine On 
RewriteBase /blog/ # This is the thing which made me struck with this 
RewriteRule ^index\.php$ - [L] 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^post/([0-9]+)/?$ post.php?id=$1 [NC,QSA] 
</IfModule> 
0

^post이 문제입니다. 이는 게시가 경로의 첫 번째 부분 인 것을 의미합니다 (blog). 당신이 ^blog/post...을 시도 유무 :

<IfModule mod_rewrite.c> 
RewriteEngine On 
RewriteBase/
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^blog/post/([0-9]+)/?$ blog/post.php?id=$1 [NC,L] 
</IfModule> 
+0

나는 그것을 또한했다. 그러나 아무 사용도. 그것은 동일한 URL을 보여줍니다! 내 xampp의 설정 문제로 인한 것입니까? – vignesh

+0

아, 맞아. 나는 내 대답이 어쨌든 약간 잘못되었다고 생각한다 - 나는 그것이 효과가있을 것이라고 믿는 것으로 편집했지만, 당신의 방법은 완벽하게 유효하다. – n00dle