Mod rewrite

software development

#1

hi i have problem with htaccess
i have a link like this

view.php?id=1&cat=4

and i want to make it as

view.html?id=1&cat=4

i just want to use “.html” instead of ".php"
hope someone can help me. thanks


#2

if the actual file is .php but you want it to be web-accessible as .html, you can use this:

RewriteEngine On
RewriteRule^(.+).html $1.php

you don’t need to worry about the query string because mod_rewrite acts on the request without the query string.

this of course would make every request for an html file load it up from the php file, so if that’s not exactly what you’re looking for (i.e. you actually have some html files that should be used) you’d need to make it a little more complicated.

track7 - my dream-hosted site


#3

i tried that but it loads the view.php into my index.php
i want it to load seperately bec these are diff files.
what should i do? can you please help me?

i am also not using any .html file

thanks.


#4

I am fumbling around wit a Joomla project on dreamhost, Joomla seo component notes indicate that mod_rewrite must be enabled for either built in or 3rd party seo functions (which rewrite messy Joomla page addresses to something friendly)

Docs indicate that if Joomla doesn’t list mod_rewrite in it’s system prfile I need to:
“ask your web host to activate mod_rewrite”

Will Dreamhost do this, is indeed mod_rewrite off by default.


#5

mod_rewrite is on by default so you don’t need to worry!

Free unique IP and $67 off with code [color=#CC0000]LMIP67[/color] or use [color=#CC0000]LM97[/color] for $97 off. Click for more promo code discounts