URL type

I saw this on a site

and am not sure where it goes or how it is interpreted by the receiving code. Without a page extension (.html, .php) or a closing / indicating a directory root, where does this go and how is it handled?

Is this indicative that it is going to a pre-constructed page or is it definitely going to some form of server side language?


Regarding the 2[L] being returned, I just added a space before the [L] and now it works fine. So the only question left is on performance and how many rules is reasonable.

No, you must write also rewrite rule,

Your .httacces should look like this:

Options +FollowSymLinks -Indexes

RewriteEngine On 

RewriteCond %{HTTP_HOST} ^(yourdomain\\.com)$ [NC] 
RewriteRule ^(.*)$ http://www.%1/$1 [R=301,L]  
// if you want always redirect people from domain.com to www.domain.com

RewriteRule ^c/([a-zA-Z0-9]+)/([a-zA-Z0-9]+)? index.php?city=$1&type=$2[L]
RewriteRule ^b/([a-zA-Z0-9]+)/([a-zA-Z0-9]+)? index.php?smthElse=$1&smthElse=$2[L]

after last rule, you should press enter to leave empty line in the end.

Okay, so if I want to write multiple rules, I just start on the next line with another ^ ?

Correct, can be also c/Seattle/Hotels etc.
[L] = last, if your link will match with this rule, will not check others

Chances are they are re-writing the URL and directing it to a controller of some sort. Both Apache & IIS allow the re-writing of URLs, a quick search should be fruitful.

Thanks, that helps a lot. I do appreciate it.

One more quick question, what is the [L] at the end? Is that a line feed so I can add another?

So in this case $1 would be Houston and $2 would be restaurants correct? And I can accept any character in the set between those two slashes and it is my passed argument.

That helps to clarify it. I had read about the substitution but it’s nice to see a real example.

Thanks for the input.

You can do this easly by using .htaccess

For example, when u have /index.php?city=houston&type=restaurants you can change this to /c/houston/restaurants by adding this code to your .htaccess files

RewriteRule ^c/([a-zA-Z0-9]+)/([a-zA-Z0-9]+)? index.php?city=$1&type=$2[L]

This should help you to understand how it works.

Another question, when I read the value for the second argument, I had set it to 2 in the page and when I send it, it returned 2[L], so it is picking up the closing [L] tag.

Also, how many of these rules is it practical to write, i.e. is there a significant performance hit if you increase the number of rules? So in the range, might it be 10, 50, 200…?

Thanks, that certainly points me in the right direction. I appreciate the help.