Forum Moderators: phranque
RewriteRule ^(.*)/(.*)$ [sub.domain.com...] [NC]
this is subdomainurl/subfolder/file
now everything works fine. but the problem is the products images are not display in pages. all pages images are display correct. like logo, bullets etc. these images are in "images" folder and product images are in "productimg" folder.
there is form on the page and under that form product images are not display.
i send the path for images like this:- /folder/images/spacer.gif (these display fine)
product images path like this:- /folder/productimg/pro1.jpg
please tell me whats the problem or i have to make changes in product_details.php file. did i have to change the links there. is there any way that all links and forms works without changing the product details page.
Thanks in advance.
Remember that ".*" matches anything -- including aditional slashes and subdirectory levels. Using multiple "." subpatterns in a pattern is also particularly inefficient.
I'd suggest that you make your RewriteRule pattern much more specific, or use a RewriteCond to exclude image paths from being rewritten.
I cannot say which is better, because I do not know how your site is structured. You'll need to decide the best way to examine the URL and decide whether or not it should be rewritten to your product_detail.php script. Then create a regular-expressions pattern to implement that.
Jim
the site structure is below.
mysite (http://www.mysite.com)
¦
¦-Folder (this is use as sub domain. [folder.mysite.com...] )
--¦
--¦-subfolder(this is folder of sub domain. [folder.mysite.com...]
----¦-.htaccess
----¦-product_details.php
----¦-images (this is images folder)
----¦-css (this css folder)
----¦-productimg (this is product images folder)
please help me to sort out this problem.
Thanks in advance.
First, let's try disabling the rule for image and css subfolders, while making the rule more specific and efficient:
RewriteCond $1 !^(images¦css¦productimg)$
RewriteRule ^([^/]+)/(.+)$ http://sub.example.com/folder/product_detail.php?pid=$1&pname=$2 [NC,L]
If your script can accept a 'blank' pname, then change the "(.+)" in the RewriteRule pattern to "(.*)"
Jim
[edited by: jdMorgan at 1:50 pm (utc) on July 30, 2006]