I've been having fun with mod_rewrite using .htaccess to translate some sites - for reasons of both enhanced Search engine optimization also to produce user friendly/more memorable Web addresses.

The only issue I can not crack right now is by using trailing slashes. The behavoir I would like is you should have the ability to access the hyperlink without or with a trailing slash, simply to cut lower on skipped traffic.

My real url is really as:


I'd like individuals to have the ability to can get on via:


Obviously, the very best two are covered because thats really a genuine and accessible URL, however i intend to tell Google that the easiest method to reach the page is applying /ships (without needing to move sites, break existing links etc).

The very best I emerged with to date was:

RewriteRule ^ships/$ /shipyard/index.php [L]
RewriteRule ^ships$ /shipyard/index.php [L]

However just Realize that i am using two lines where just one is required, but whatever I attempted, I could not obtain the one! I understand i am missing something incredibly fundamental and/or apparent, however i require a pointer... Thanks!

RewriteRule ^ships(/)?$ /shipyard/index.php [L]

Which means that the slash might show up.