santa
santa

Reputation: 12512

Rewriting link with .htaccess

I am trying to rewrite links with .htaccess file. Basic stuff, but for some reason it does not work. I need the name of the file, before .php to be the last word in URL. What am I missing here?

RewriteRule ^/product/(.*)$ /incl/static/products/$1.php [NC,L]

Upvotes: 0

Views: 59

Answers (1)

undone
undone

Reputation: 7888

as Marc said you need something to distinguish the script file name and other parts:

RewriteRule ^products/script/(.*)/(.*)$    $1.php?$2&%{QUERY_STRING}

But if after first (.*) is query string , so use it:

RewriteRule ^products/script/(.*)$    $1.php?%{QUERY_STRING}

Upvotes: 1

Related Questions