Forum Moderators: phranque
DirectoryIndex merchant.mvc?Screen=SFNT&Store_Code=SSS&Category_Code=home
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !-s
RewriteRule ^([^/]*)$ /Merchant2/merchant.mvc?Screen=NBSEOLINK&thecode=$1 [L=301]
RewriteEngine on
#
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-s
RewriteRule ^([^/]*)$ /Merchant2/merchant.mvc?Screen=NBSEOLINK&thecode=$1 [L]
Jim
Original Default URL Format:
Storefront:
[domain.com...]
Category:
[domain.com...]
Product:
[domain.com...]
So even without rewrites I have to redirect the root to the storefront URL. I also have to include a category code in the storefront URL so I can assign products to be displayed on the homepage. So the actual full URL to my homepage is in the format of:
[domain.com...]
Provided URL Rewrite Format:
Storefront:
[domain.com...]
Category:
[domain.com...]
Product:
[domain.com...]
Generated .htaccess when rewrite settings enabled:
RewriteEngine On
RewriteRule ^Merchant2/admin.mvc? - [L]
RewriteCond %{REQUEST_FILENAME} !-s
RewriteRule ^product/([^/.]+).html$ /Merchant2/merchant.mvc?Screen=PROD&Product_code=$1 [L]
RewriteRule ^category/([^/.]+).html$ /Merchant2/merchant.mvc?Screen=CTGY&Category_code=$1 [L]
RewriteRule ^([^/.]+).html$ /Merchant2/merchant.mvc?Screen=$1 [L]
Third-Party Module URL Format:
Category:
[domain.com...]
Product:
[domain.com...]
Third-Party Provided .htaccess:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^.]+)\.html$ /mm5/merchant.mvc?Screen=NBSEOLINK&thecode=$1 [L]
My Desired URL Format:
Storefront:
[domain.com...]
Category:
[domain.com...]
Product:
[domain.com...]
Current .htaccess:
DirectoryIndex /Merchant2/merchant.mvc?Screen=SFNT&Store_Code=storecode&Category_Code=categorycode
#
RewriteEngine On
#
RewriteCond %{REQUEST_FILENAME} !-s
RewriteRule ^([^/]*)$ /Merchant2/merchant.mvc?Screen=NBSEOLINK&thecode=$1 [L]
However, the homepage rewrite doesn't work. It works for if I type the URL: [domain.com...] but I can't get it to work for the root of the domain.
However, the homepage rewrite doesn't work. It works for if I type the URL: [domain.com...] but I can't get it to work for the root of the domain.
Please define "doesn't work" -- Server error? Nothing happens? The wrong thing happens?
Please define "root of the domain" -- Do you mean "www.domain.com/"?
Also, please let us know *where* each "generated .htaccess file" is located -- The function of code in .htaccess files depends on that file's location.
Not trying to be pedantic, but we can't use imprecise language here unless you want incorrect answers... It is best to assume that we know nothing whatosever about your software, your URL-space, or your file locations (which is why I asked for both URLs and the filepaths that those URLs resolve to).
Also, our contributors here are limited both in number and in willingness to invest their time; Clear questions get faster, better answers.
So that perhaps you won't consider this latest exchange to be a total loss, be aware that if "the root of the domain" that you want to rewrite is indeed "www.domain.com" and if this .htaccess code is located in /Merchant2/.htaccess, then it cannot "work", because only URLs starting with /Merchant2 will cause the .htaccess code in that subdirectory to be executed. If you want to rewrite the "home page" URL, then you'll have to put a rule in www.domain.com/.htaccess
Thanks,
Jim
Yes, by root of the domain I meant www.domain.com/
My .htaccess file is located www.domain.com/
The shopping cart is located www.domain.com/Merchant2/
After uploading the .htaccess file, www.domain.com/ returns a fatal error generated from the shopping cart “Unknown page error”. Which sounds like the shopping cart is not receiving the Screen parameter. But www.domain.com/productcode and www.domain.com/categorycode work and www.domain.com/Merchant2 returns the storefront page. I cannot get the path for the DirectoryIndex to properly resolve the storefront.
RewriteRule ^$ merchant.mvc?Screen=SFNT&Store_Code=SSS&Category_Code=home [L]
Also note that the vendor-supplied code fails to escape literal periods. For example,
RewriteRule ^product/([^/.]+).html$ /Merchant2/merchant.mvc?Screen=PROD&Product_code=$1 [L]
RewriteRule ^product/([^/.]+[b])\.h[/b]tml$ /Merchant2/merchant.mvc?Screen=PROD&Product_code=$1 [L]