Forum Moderators: phranque
i have add the rewrite rule on .htaccess file. but when i try the links on page, still the same .
from
[mybusiness.com...]
to
[mybusiness.com...]
--------------------------
RewriteEngine on
RewriteBase /
RewriteRule /name1_([^-]*)_([^-]*)_(.*).html /name3.php\?id=$1&page=$2 [I]
-------------------------------------
thanks in advance
Jim
when i tried to use the rule on server, but it just change nothing.
i have checked the server configuration, and it seems installed the mod_rewrite already.
can you help to see what is wrong on the code?
any sample code for this rule will appeciate.
PS:
1. the second variable page will sometime has sometime don't.
2. i use underscore "_" to separate the different parts due to there are product name may use "-" sometimes.
-------------------------------------------------
from
[mybusiness.com...]
to
[mybusiness.com...]
--------------------------
RewriteEngine on
RewriteBase /
RewriteRule /name1_([^-]*)_(.*).html /name1.php\?id=$1&page=$2 [I]
-------------------------
many thanks
webon
Rewrite example.com/name1_product-name_2.html to example.com/foldname/name1.php?id=product-name&page=2
RewriteRule ^name1_([^_]+)_([^.]+)\.html$ /foldname/name1.php?id=$1&page=$2 [L]
from
[mydomain.com...]
to
[mydomain.com...]
RewriteEngine on
RewriteBase /
RewriteRule ^product_([^_]+)_([^.]+)\.html$ /foldname/product.php?Type=$1&page=$2 [L]
i have upload the .htaccess file on my unix server, file is under html fold, and everything also under html fold. When i browser the page and try the links on page, it doesn't change at all.
1. the unix server for sure installed the mod_rewrite
and i don't think some wrong with the code.
2. is there still anything i missing here?
many thanks.
webon
Are you expecting the address in the browser address bar to change? That is not what this rule does. This rule tells the server to pass requests for the product_typename_1.html URL in your browser address bar to the product.php script, with the variables in the proper order.
Do you have *any* other working rewriterules? If not, you may want to try something simple first, rather than trying this somewhat 'advanced' rewrite to a script.
Do you have a simple 'index.html' page or something like it? If so, try a rule like this:
RewriteEngine on
Options +FollowSymLinks
RewriteRule ^silly\.html$ /index.html [L]
Jim