views:

21

answers:

2

I have an HTML file I want rewritten as a subfolder on the server.

http://www.example.com/kids-and-family/185-summer-camp.html

to be shortened to:

http://www.example.com/camp

Is there an rewrite condition where I can make this happen in .htaccess?

Can I say if (/camp) then display /kids-and-family/185-summer-camp.html?

I have been looking for this but have not found anything.

+2  A: 

Try this rule:

RewriteEngine on
RewriteRule ^camp$ kids-and-family/185-summer-camp.html [L]

If you want an external redirect, add the R flag ([L,R]) with an additional redirect status like 301 for a permanent redirect ([L,R=301]).

Gumbo
A: 

in your .htaccess file, try this:

RewriteEngine on

RewriteCond %{REQUEST_URI} "/camp"
RewriteCond %{REQUEST_FILENAME} !-s
RewriteCond %{DOCUMENT_ROOT} /kids-and-family/185-summer-camp.html -s
RewriteRule ^$ /kids-and-family/185-summer-camp.html [L]
Lucas Renan