How do i redirect
website.com/about.php
to
website.com/about
Also, is it possible to manually create the appearance of subdirectories using .htaccess?
i.e. website.com/project1.php
to
website.com/projects/project1
Much appreciated!
How do i redirect
website.com/about.php
to
website.com/about
Also, is it possible to manually create the appearance of subdirectories using .htaccess?
i.e. website.com/project1.php
to
website.com/projects/project1
Much appreciated!
Yes!
You can use the Apache RewriteEngine module to achieve this end. The documentation is here: http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html
There are a number of good tutorials around also.
Some examples of rules are:
RewriteRule ^/(\S+).php /$1
RewriteRule ^/(project\d+).php /projects/$1
However, these are just guesses at what you might want to achieve, there are always corner cases. (Also, these are not tested!)
Bear in mind the above two rules would not necessarily be good together as written. Take note in the documentation about setting up the RewriteEngine and using appropriate RewriteRule options.
For example, when specifying many RewriteRules it is common to specify the [L] option so that the RewriteEngine stops rewriting after the rule is applied. Ordering of rules, therefore, can be significant.
Here are your examples putting the .htaccess on your root directory and using mod_rewrite
RewriteEngine on
RewriteRule ^about\.php$ about [R]
RewriteRule ^projects/project([0-9]+)$ project$1.php