http://www.mysite.com/folder/page.ph...2=var2&c3=var3
I want to display my page as
www.mysite.com/folder/var1/var2-var3.html
What will be code for mode rewrite (.htaccess) . Anybody can help me?
| SitePoint Sponsor |
http://www.mysite.com/folder/page.ph...2=var2&c3=var3
I want to display my page as
www.mysite.com/folder/var1/var2-var3.html
What will be code for mode rewrite (.htaccess) . Anybody can help me?

rash,
I'd be happy to help - if you would show what you've attempted.
It looks to be trivial - at least it would be if you've read the tutorial Article linked in my signature.
Regards,
DK
David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
Client and (unpaid) WHB Ambassador
Updated mod_rewrite Tutorial Article (setup, config, test & write
mod_rewrite regex w/sample code) and Code Generator
<a href="http://www.mysite.com/folder/var1/var2-var3.htmlCode:RewriteEngine on RewriteRule ^/?([a-zA-Z_]+)/([a-zA-Z_]+)/([a-zA-Z_]+)/$ index.php?c1=$1&c2=$2&c3=$3 [NC,L]
but not working. (404 Error)

rash,
Thanks! That makes the error pretty easy to spot!With <a href="http://www.mysite.com/folder/var1/var2-var3.html"> as your link, I've replaced the second directory dividing / in your regex with a blue hyphen (-) and recommend that you remove the red No Case flag as you've already covered that with the a-zA-Z in the regex (and your script should be handling that).Code:RewriteEngine on RewriteRule ^/?([a-zA-Z_]+)/([a-zA-Z_]+)-([a-zA-Z_]+)/$ index.php?c1=$1&c2=$2&c3=$3 [NC,L]
It's simply a matter of specifying what the link will be. With that, the regex becomes a simple matter.
Regards,
DK
David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
Client and (unpaid) WHB Ambassador
Updated mod_rewrite Tutorial Article (setup, config, test & write
mod_rewrite regex w/sample code) and Code Generator
Not working (404 Error)

rash,
Test URL? Specificity, please, as it REALLY helps when we're trying to help you.
If it's the var1, etc, then you'll need to add digits to your character ranges, i.e., each [a-zA-Z_] should become [a-zA-Z0-9_].
Regards,
DK
David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
Client and (unpaid) WHB Ambassador
Updated mod_rewrite Tutorial Article (setup, config, test & write
mod_rewrite regex w/sample code) and Code Generator
This is my file (2index.php)
Code:<a href="http://www.ouchh.com/Weather/europe/england-london.html" >London Weather</a> <br><br> <?php $c1 = $_GET['c1']; $c2 = $_GET['c2']; $c3 = $_GET['c3']; $c4 = $_GET['c4']; $c5 = $_GET['c5']; echo $c1; echo $c2; echo $c3; echo $c4; echo $c5; ?>
This is my .htaccess
Code:RewriteEngine On RewriteRule ^([^/]*)/([^/]*)-([^/]*)\.html$ 2index.php/?c1=$1&c2=$2&c3=$3&c4=v4&c5=v5 [L]

rash,
The URL you provided does not match the problem defined above. Moreover, your mod_rewrite code ignores all of the above.
SPECIFICITY, please!Code:RewriteEngine on RewriteRule ^/?([a-zA-Z_]+)/([a-zA-Z_]+)/([a-zA-Z_]+)-([a-zA-Z_]+)$ index.php?c1=$1&c2=$2&c3=$3&c4=$4 [L]
Regards,
DK
David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
Client and (unpaid) WHB Ambassador
Updated mod_rewrite Tutorial Article (setup, config, test & write
mod_rewrite regex w/sample code) and Code Generator
so what is the solution for my problem.

David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
Client and (unpaid) WHB Ambassador
Updated mod_rewrite Tutorial Article (setup, config, test & write
mod_rewrite regex w/sample code) and Code Generator
Are you developing this on your local machine, or on a live server?
I tried, but (404 page not found) error receiving
On Live serverAre you developing this on your local machine, or on a live server?

rash,
Are you redirecting to index or 2index for this? Change to 2index if that's the correct script (and can be found).
Regards,
DK
David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
Client and (unpaid) WHB Ambassador
Updated mod_rewrite Tutorial Article (setup, config, test & write
mod_rewrite regex w/sample code) and Code Generator
I am redirecting to index.php

rash,
That should work for your original post.Code:RewriteEngine on RewriteRule ^/?([a-zA-Z_]+)/([a-zA-Z_]+)-([a-zA-Z_]+)/$ index.php?c1=$1&c2=$2&c3=$3 [NC,L]
Regards,
DK
David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
Client and (unpaid) WHB Ambassador
Updated mod_rewrite Tutorial Article (setup, config, test & write
mod_rewrite regex w/sample code) and Code Generator
Bookmarks