30

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 ...


11

Yes, the latter one is better. Yet, if applicable, /john-smith is better than /johnsmith


10

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. So ...


8

All four of your URLs are different for SEO: http://www.example.com/product http://www.example.com/product/ http://www.example.com/product?source=googleps http://www.example.com/product/?source=googleps 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 ...


6

Compare these URLs: http://example.com/スター・ウォーズ×マンガ/ http://example.com/1234/ 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?...


6

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 /, ...


6

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 ...


5

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.


5

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 ...


5

There are several PHP microframeworks that allow you to create a simple application with "pretty URLs" by defining the available routes: Slim Flight Limonade Glue For example, this short Limonade app would respond to requests at the root domain (example.com/) and at the specified route (example.com/hello): <?php require_once 'vendors/limonade.php'; ...


5

I think the following would work: RewriteRule ^/index\.php/rss/rss1klik$ /index.php?option=com_obrss&task=feed&id=2:rss1klik&format=feed&Itemid=160 [L] But this may look better: RewriteRule ^/rss/rss1klik$ /index.php?option=com_obrss&task=feed&id=2:rss1klik&format=feed&Itemid=160 [L] Then the URL would be http://mydomain....


5

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 ...


5

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 ...


5

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.


4

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. http://msdn.microsoft.com/en-us/library/ms524602(v=vs.90).aspx


4

Use canonical URLs or 301 redirects. Canonical URL: <link rel="canonical" href="http://www.domain.com/webdesign/" /> That will tell Google to use that URL in its search results.


4

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 ...


4

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.


4

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. .htaccess RewriteEngine On #ADD ...


4

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,...


4

The "hashbang" or "shebang" url syntax is an old hack designed to provide browser history to AJAX sites and to help Google index content that is loaded via JavaScript. See "What's the shebang/hashbang (#!) in Facebook and new Twitter URLs for?" for more. Your WordPress theme, "John Smith", is responsible for rewriting URLs in this way. It does this so that ...


4

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 ...


4

You can use one of these solutions: Keep the Current .html extension unchanged for just frontend purpose and use Apache .htaccess file to proxify your requests so that. Add this to your .htaccess file to work: RewriteEngine on RewriteRule ^(.*).html $1.php OR Why not just have the HTML pages parsed as PHP? That way you can get the best of both php ...


4

You need to set an alias. location /coolapp/ { alias /var/www/apps/coolapp/; } Read more nginx Update after comment: Unfortunately, it's not working for me. I'm getting a 404 response when trying to request www.mysite.com/coolapp/test.php when /var/www/apps/coolapp/test.php exists To understand why alias is not working, you have to take a ...


4

Search engines see both dashes and slashes as word separators, so they will be able to parse either of your URLs. Traditionally slashes in URL paths represent directory structures. Because of this, some users may expect that if you use /blue/suede-shoes/ they should be able to find a page at /blue/ with information about all your blue products. I would ...


4

The software 'WebsitePanel' does not allow you to make subdomains of a subdomain. You could use a sub-domain to create a new web site, but you cannot create another sub-domain based on it. From http://www.websitepanel.net/documentation/users-guide/domains/#ManagingSub-Domains


4

Apache server can be configured to show the error page at the error URL, or it can redirect to the error page. It is almost better to show the error page directly at the URL rather than redirecting to it. The Apache ErrorDocument directive explains how to implement it both ways: URLs can begin with a slash (/) for local web-paths (relative to the ...


4

tl;dr Yes, you can enable MultiViews to serve extensionless URLs. ie. Where the file extension is omitted from a URL that would otherwise map to an existing file. However, be aware of potential conflicts with mod_rewrite. the server won't even open links to the site that are missing a file extension You make it sound that this should be normal (or ...


4

If the underlying filename is script.js.php then it doesn't make sense to rewrite this to script.js - as that would result in a 404. However, the directives you posted would seem to result in a 404 for a different reason, as they rewrite script.js.php to script.js.php.js. Presumably, you want to link to script.js?c=21 and internally rewrite this to script....


4

If you correctly put in 301 redirects and update your sitemap, the site will be fine. However... What are you trying to gain from this change? The Stack Exchange-style hierarchy doesn't make sense for what it seems you're trying to accomplish (a Wikipedia-style website?). What you currently have makes more sense in terms of organizing the information: ...


Only top voted, non community-wiki answers of a minimum length are eligible