I am writing a simple .htaccess
- file to limit the access to my site.
Now, that this site is ok, I'd like to rewrite the url, but it seems that my regexs have no effect..
Here is my .htaccess
- file:
AuthType Basic
AuthUserFile /www/MW_qXXGGqXqq/mysite.it/.htpasswd
AuthName "Members Area"
require valid-user
RewriteEngine on
RewriteBase /
DirectoryIndex index.php
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^https?://(?:www\.)?mysite.it(?:$|/) [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule \.(gif|jpg|jpeg|png|mp3|mpg|avi|mov)$ - [F,NC]
RewriteRule ^[management]$ yacht_management.php [NC,L]
RewriteRule ^[yacht]$ list_yacht.php [NC,L]
RewriteRule ^[technicalsupport]$ technical_support.php [NC,L]
RewriteRule ^[crew]$ inquiry.php [NC,L]
RewriteRule ^[contact]$ contact.php [NC,L]
How can I change this code so my url becomes www.mysite.it/management/
instead of www.mysite.it/yacht_management.php
?
You are using a [
character class]
here:
RewriteRule ^[management]$ yacht_management.php [NC,L]
That will not match the whole word, but just one of the letters from it.
Leave out the square brackets:
RewriteRule ^management$ yacht_management.php [NC,L]
Then also include the trailing /
slash that you want, preferrably make it optional with ?
:
RewriteRule ^management/?$ yacht_management.php [NC,L]
Same for all your other rules.