ranbir
ranbir

Reputation: 79

how to rewrite url with html extension

How can i rewrite my website urls as given below detail

static-page.php?statictour=agra-jaipur to agra-jaipur.html

our code is RewriteRule ^([a-zA-Z0-9_-]+).html$ static-page.php?statictour=$1 [NC,L] above code working but index.html file not working when this code apply anybody can help ?

Upvotes: 1

Views: 520

Answers (1)

Amit Verma
Amit Verma

Reputation: 41219

The problem is that index.html also matches the pattern ^([A-Za-z0-9-]+).html$ and redirects to /static-page.php .

You need to exclude index.html from the rule :

RewriteCond %{REQUEST_URI} !^/index\.html$
RewriteRule ^([a-zA-Z0-9_-]+).html$ static-page.php?statictour=$1 [NC,L]

Upvotes: 1

Related Questions