htaccess add .html extension for urls with or without trailing slash
So to begin with I have a custom url rewrite that sends a request variable
to a php script
Rewrite rule is below:
RewriteRule ^([\w\/-]+)(\?.*)?$ test/index.php?slug=$1
[L,T=application/x-httpd-php]
So if you access something like domain.com/slug-text it sends slug-text to
index.php located in folder named test.
What I want is all my urls to look like domain.com/slug-text.html, but
slug-test variable should still be sent to index.php file.
And
What I can't figure out is the redirect. I want all the old urls to be
redirected from domain.com/slug-text or domain.com/slug-text/ to
domain.com/slug-text.html and slug-text sent to index.php file located in
test folder.
Searched a lot but could not find the answer for this question anywhere on
the Internet.
Thank you all for the help.
No comments:
Post a Comment