Question

Using the following htaccess code i am only getting the filename.

But what i need is that if user visits a url

http://TEMPLATE.domain.com/FILENAME.html   

then i get it as

index.php?page=site/FILENAME&skin=TEMPLATE

.htaccess code:

Options +FollowSymLinks -indexes
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /

RewriteCond %{HTTP_HOST}    ^([a-z0-9]+)\.domain\.com$  [NC]
RewriteCond %{REQUEST_URI}  ([a-z0-9]+).html$                   [NC]
RewriteRule ^[^.]*.html$    index.php?page=site/%1&skin=%2      [L]
Était-ce utile?

La solution

Try changing your rule to:

RewriteCond %{HTTP_HOST} ^([a-z0-9]+)\.domain\.com$  [NC]
RewriteRule ^([a-z0-9]+).html$ index.php?page=site/$1&skin=%1 [L,NC]

Specifically, you're backreference is being lost, so you need to create one backreference for your previous RewriteCond (via %1) and then one against the rule's regex, which is backreferenced via $1.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top