How can I create a friendly URL in ASP.NET MVC?

There are two steps to solve this problem. First, create a new route or change the default route to accept an additional parameter: routes.MapRoute( “Default”, // Route name “{controller}/{action}/{id}/{ignoreThisBit}”, new { controller = “Home”, action = “Index”, id = “”, ignoreThisBit = “”} // Parameter defaults ) Now you can type whatever you want to … Read more

Can an “SEO Friendly” url contain a unique ID?

Be careful with allowing a page to render using the same method as Stack overflow. http://stackoverflow.com/questions/820493/random-text-can-cause-problems Black hats can this to cause duplicate content penalty for long tail competitors (trust me). Here are two things you can do to protect yourself from this. HTTP 301 redirect any inbound display url that matches your ID but … Read more

How can I remove file extension from a website address?

Just add an .htaccess file to the root folder of your site (for example, /home/domains/domain.example/htdocs/) with the following content: RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}\.php -f RewriteRule ^(.*)$ $1.php More about how this works in these pages: mod_rewrite guide (introduction, using it), reference documentation

Should I use accented characters in URLs?

There’s no ambiguity here: RFC3986 says no, that is, URIs cannot contain unicode characters, only ASCII. An entirely different matter is how browsers represent encoded characters when displaying a URI, for example some browsers will display a space in a URL instead of ‘%20’. This is how IDN works too: punycoded strings are encoded and … Read more

How to create friendly URL in php?

According to this article, you want a mod_rewrite (placed in an .htaccess file) rule that looks something like this: RewriteEngine on RewriteRule ^/news/([0-9]+)\.html /news.php?news_id=$1 And this maps requests from /news.php?news_id=63 to /news/63.html Another possibility is doing it with forcetype, which forces anything down a particular path to use php to eval the content. So, in … Read more

Reference: mod_rewrite, URL rewriting and “pretty links” explained

To understand what mod_rewrite does you first need to understand how a web server works. A web server responds to HTTP requests. An HTTP request at its most basic level looks like this: GET /foo/bar.html HTTP/1.1 This is the simple request of a browser to a web server requesting the URL /foo/bar.html from it. It … Read more