You are here:  » URL questions


URL questions

Submitted by macland on Fri, 2016-09-23 13:40 in

2 quick questions on URLs.

1) I would like to enable www. as a prefix on the entire site. Would this be possible?

2) I have some custom pages. Can I rewrite the urls so that instead of /example.php the url will be /example/ as that fits with my current structure?

Submitted by support on Fri, 2016-09-23 14:26

Hi,

> 1) I would like to enable www. as a prefix on the entire site.

If you would like to ensure that www. is always used, in other words, if your web server is configured so that example.com and www.example.com both work, and if somebody visits your site using example.com you would like them to be redirected (using 301 Moved Permanently) to the www. version, edit your .htaccess file and look for the following rule at line 3:

RewriteEngine On

...and REPLACE with:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^example.com [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]

> 2) I have some custom pages. Can I rewrite the urls so that
> instead of /example.php the url will be /example/ as that
> fits with my current structure?

Sure - to add rules for your custom pages, add at the end of .htaccess, for example:

RewriteRule ^example/$ example.php

Cheers,
David.
--
PriceTapestry.com