2017-02-17 14 views
0

動的なURLを静的なURLに変更してseoのURLを変更したいと思います。 http://localhost/new/books_list.php?subject_id=2動的なURLから静的なURLへの変更

静的URL:http://localhost/new/books_list/subject_id/2/

PHPコード:

<?php 
$connect=mysql_connect("localhost","root",""); 

$select=mysql_select_db("test",$connect); 

if($_REQUEST[subject_id]!=""){ 

$subject_id=$_REQUEST[subject_id]; 

htaccessのコード:

Options +FollowSymLinks 
RewriteEngine on 
RewriteRule books_list/subject_id/(.*)/ books_list.php?subject_id=$1 
RewriteRule books_list/subject_id/(.*) books_list.php?subject_id=$1 
修正してください問題

動的URLを私のPHPコードとhtaccessのコードを吹きます

この問題を解決するのに役立ちます。修正するにはあまりにもジューシーでタイプミス 感謝

+2

... – Benjamin

+1

はあなたの問題は、エラーなどで、あなたがそれを修正しようとしています正確に何を説明してください。 – Benjamin

+0

動的URLを静的に変更する必要があります – Jayabal

答えて

0
i have a code like this check that and change as per your requirement 
# Enable mod_rewrite, start rewrite engine 
Options +FollowSymLinks 
RewriteEngine on 
# 
# Internally rewrite search engine friendly static URL to dynamic filepath and query 
RewriteRule ^product/([^/]+)/([^/]+)/([^/]+)/([^/]+)/([^/]+)/?$ /index.php?product=$1&color=$2&size=$3&texture=$4&maker=$5 [L] 
# 
# Externally redirect client requests for old dynamic URLs to equivalent new static URLs 
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\?product=([^&]+)&color=([^&]+)&size=([^&]+)&texture=([^&]+)&maker=([^\ ]+)\ HTTP/ 
RewriteRule ^index\.php$ http://example.com/product/%1/%2/%3/%4/%5? [R=301,L] 
関連する問題