There are several reasons to remove extensions from URLs:
To make the URLs look cleaner
To make URLs easier to type
To make URLs easier to remember
To make URLs more SEO keyword friendly
To be able to change technologies -- if you ever want to move your site from one technology to the other, its easiest to do so without users even knowing if there are no ...
I've been told that .htaccess should be avoided when possible, as it reduces the server performance and new servers disables it or just don't implement it anymore.
The part about compatibility is absolutely not true; the part about performance is kinda true but probably irrelevant for you.
What the person you quote was probably talking about is that it's ...
You shouldn't need to use percent encoding/hexcode in mod_rewrite parameters since mod_rewrite will encode special characters (?, #, , &, etc.) by default. To write a space in the rewrite pattern, use \s or just escape the space with a backslash (\). Whether space gets encoded as %20 or + depends on whether it's part of the query string or the URI.
No offense intended, but Case Sensitivity is VITAL to urls today - they are used millions of times a day:
Two vastly different sites - only possible because of case sensitivity
Thanks for your time to look at the question, but we appeared to have figured it out:
Options -Multiviews -Indexes +FollowSymLinks
# remove trailing slash
RewriteRule ^(.*)\/(\?.*)?$ $1$2 [R=301,L]
# rewrite /dir/file?query to /dir/file.php?query
RewriteRule ^([\w\/-]+)(\?.*)?$ $1.php$2 [L,T=application/x-...
All four of your URLs are different for SEO:
It doesn't matter which one of those four you use, but you have to pick one and use it consistently. Both slashes and parameters create new URLs to ...
The best way is to use 301 redirects in your .htaccess file, the 301 code signals to google that the url has been permanently redirected.
I'd also recommend signing up for Google Webmaster Tools and submitting a sitemap to them, if you haven't already, as this will help them to understand the changes you're making to your site.
redirect 301 /old-url http:/...
Compare these URLs:
Which is going to bring in more relevant search traffic? It's possible that more people are searching for "1234" on Google than for the title of a Japanese Star Wars manga, but how likely are the "1234" searchers going to be interested in a thread about Japanese Star Wars mangas?...
All web servers have one or more "default files". It's the file that will be displayed whenever a visitor goes to a URL that ends in a slash /, i.e. a folder.
If the default file name on your web server is index.php and a visitor goes to www.example.com/pagename/, they are actually accessing www.example.com/pagename/index.php.
If there is no trailing /, ...
Just redirect by 301 HTTP status all your old URLs to the new ones. If you only change file extension, you can do it easily with an .htaccess file (if you use Apache as a web server).
Put these lines in your .htaccess file:
RedirectMatch 301 (.*)\.html$ http://www.example.com$1.php
Of course, change www.example.com by your domain name.
By using 301 ...
Google sees the URL you publish. The rewrite happens in the background and is invisible to them. So as long as your URL is valid and the content you want can be reached with it Google will index it just fine.
Google explains the use and impact of URL parameters in this article: http://googlewebmastercentral.blogspot.com.au/2008/09/dynamic-urls-vs-static-urls.html
The short answer is that with simple key/value query strings like yours, there's no issue.
Personally I am a fan of the one domain approach like you are doing but just thought I would also provide few more considerations to add to the already good advice given by others here.
SEO is a major reason for going with two domains OR one. Two domains = two seperate marketable sites and one can be posted in app market places. On the other hand you're ...
There are several PHP microframeworks that allow you to create a simple application with "pretty URLs" by defining the available routes:
For example, this short Limonade app would respond to requests at the root domain (example.com/) and at the specified route (example.com/hello):
Note that if you need to match against the query string, you need to compare against the QUERY_STRING server variable in a mod_rewrite RewriteCond directive. You can't match against the query string using a mod_alias Redirect (or RedirectMatch) or the RewriteRule (mod_rewrite) pattern - these all match against the URL-path only, which notably excludes the ...
You are using the ^ and $ (anchors in regex speak) because you are matching the whole URL, which is what most people want to do, so this is the most common example you see.
If you omit the ^ and/or $ anchors then you are only going to be matching part of the URL. eg. anything$ is going to match "anything" at the end of the URL - this could match too many ...
It generally makes little difference.
A 301 redirect may cause a short term drop in ranking, but nothing to worry about.
An internal rewrite keeps the same URLs. You just need to be careful that you don't end up with duplicate content on multiple URLs.
If you want to redirect A to B, simply place the following directive in your .htaccess file:
Redirect / http://example.com/home/
If you want to rewrite / as /name
RewriteRule ^/$ /home/ [L]
Canonical URLs are to be used when two different URLs can be used to pull up the same content. If your URL rewriting causes this to happen then canonical URLs will be necessary.
pulls up the same content as
then you need canonical URLs
IIS Server variables
IIS server variables provide information about the server, the connection with the client, and the current request on the connection. IIS server variables are not the same as environment variables.
Aside from SEO, one issue is what the Url 'looks' like when people use/print/send it around. If you're going to redirect people to m when they go to www if they're on a mobile device, and redirect people to www from m when they're not, then what have you achieved by using separate domains?
AFAIK, there are no benefits. But the reason people have decided to ...
If your exact search term is going to be the full 'John Smith', I am pretty certain that you are indeed correct and that having /johnsmith would be better as you are targeting a more refined search term and the extension matches up completely with the search term, which we can only assume is a good thing.
I finally found a solution. The second RewriteCond in my above code was unnecessary, and the first RewriteRule below, found at B&T's Tips & Scripts, adds a trailing slash if none exists (unless it's a file, like index.php). Here's my new .htaccess. Notice the trailing slash directive only needs to be applied once.
This is the type of “cool” URI scheme that I aim for on my own personal website.
Personally, the reason that I started to do so (and probably many more web designer/developers too!) was after reading the article “Cool URIs don't change” – this document was written by the World Wide Web's founding father, Tim Berners-Lee.
In Tim Berners-Lee's famous article,...
Your WordPress theme, "John Smith", is responsible for rewriting URLs in this way. It does this so that ...
The pseudo-code translation of your .htaccess file would be something along these lines:
Line 1: In case we weren't previously planning to do anything special with URLs, we are now (RewriteEngine is an optional processing module and we're making sure its enabled).
Line 2: When we're talking about rewrite URLs, from here on append the path / to the beginning ...