0
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /products.php?brandid=27&pname=$1 [NC]

The above works only for branid=27 and If I include mutilple statements, LIKE

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /products.php?brandid=27&pname=$1 [NC]
RewriteRule ^(.*)$ /products.php?brandid=42&pname=$1 [NC]
RewriteRule ^(.*)$ /products.php?brandid=47&pname=$1 [NC]

it will also run for brandid 27,
I tried lots of stuff but wont able to rewrite rules for mutiple brandid.

For Example:
The url http://www.3gphone.in/products.php?brandid=27&pname=Acer redirects http://www.3gphone.in/Acer

2
Contributors
11
Replies
19
Views
6 Years
Discussion Span
Last Post by vibhaJ
Featured Replies
  • 1

    Just looked [url]http://www.3gphone.in/acer/27[/url]. CSS is working right.. Same way you have to give URL for product images. e.g [B]phonepics/956_1.jpg[/B] [B]should be [url]http://www.3gphone.in/phonepics/953_1.jpg[/url][/B] You can define site url in config file and append it in all images and css so if your domain transfer you have only change in config file. Read More

0
RewriteEngine On
RewriteRule ^brandid/([^/]*)/([^/]*)$ /products.php?brandid=$1&pname=$2 [L]

Above code will rewrite

http://www.3gphone.in/brandid/27/Acer

to

http://www.3gphone.in/products.php?brandid=27&pname=Acer

If your coding is fetching list from brandid then you have to pass it in URL.

Thanks for the reply..
Here it is the complete code..

Options +FollowSymLinks
Options +Indexes
RewriteEngine on

RewriteCond %{HTTP_HOST} ^3gphone\.in$ [NC]
RewriteRule ^(.*)$ http://www.3gphone.in/$1 [R=301,L]

RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /.*index\.php\ HTTP/
RewriteRule ^(.*)index\.php$ /$1 [R=301,L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /products.php?brandid=27&pname=$1 [NC]

But I need like http://www.3gphone.in/Acer not http://www.3gphone.in/brandid/27/Acer. Is it possible ?? and second thing CSS is not working..

Edited by abhi10kumar: n/a

0

Okay.The rule is :

RewriteRule ^([^/]*)$ /products.php?pname=$1 [L]

http://www.3gphone.in/Acer TO http://www.3gphone.in/products.php?pname=Acer
But as i said before if you want this url you can not use brandid in coding.

Place that rule and let me know output.

But I have to use both brandid and pname.. Coz, both query string variables are using to fetch data from database.. Again, I am asking, using both variable and Can I create http://www.3gphone.in/Acer

0

No..
If you don't pass both variable you can't use brandid in coding.

There is one option just pass pname(Acer) and on top of page use select query and get brandid from database table having model 'Acer'.

And if you want SEO friendly url then you have to also save seo friendly product name in php. space is not SEO friendly.
http://www.3gphone.in/Lemon IT 20717 should be http://www.3gphone.in/lemon-it-20717

Refere this link http://htmlblog.net/seo-friendly-url-in-php/ for php function.

Edited by vibhaJ: n/a

0

No..
If you don't pass both variable you can't use brandid in coding.

There is one option just pass pname(Acer) and on top of page use select query and get brandid from database table having model 'Acer'.

And if you want SEO friendly url then you have to also save seo friendly product name in php. space is not SEO friendly.
http://www.3gphone.in/Lemon IT 20717 should be http://www.3gphone.in/lemon-it-20717

Refere this link http://htmlblog.net/seo-friendly-url-in-php/ for php function.

Thanks, Now I understand, but my CSS is not working. What should I Do ??

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.