• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 583
  • Last Modified:

How to do mod rewrite to covert dynamic url to seo friendly url?

0
melwong
Asked:
melwong
1 Solution
 
grahamnonweilerCommented:
Create an .htaccess file as follows:

Option 1 - literal translation of "es"

Options +FollowSymlinks
RewriteEngine On
RewriteRule ^/?es$ /index.php?lang=$1 [NC]
RewriteRule ^/?es/$ /index.php?lang=$1 [L,NC]

Open in new window


Option 2 - translation of lower case characters to a language variable

Options +FollowSymlinks
RewriteEngine On
RewriteRule ^/?([a-z_]+)$ /index.php?lang=$1 [NC]
RewriteRule ^/?([a-z_]+)/$ /index.php?lang=$1 [L,NC]

Open in new window


Generally you would be safer to define explicitly your available language options (as in Option 1) as this will help reduce the chance of malicious attempts to break your website.

You can add more lines to your .htaccess to accomodate the extra langauges
0
 
melwongAuthor Commented:
thx
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now