Question: How can i redirect html page extensions to php using proper htaccess redirect as similar to this <http://www.hd2wallpapers.com/butterfly_green-wallpapers.html> gets redirected to <http://www.hd2wallpapers.com/butterfly_green-wallpapers.php>.

Answer: 
Seems like this would be a good job to handle with a metaclass:

```
class AKA(type):
    """ 'Also Known As' metaclass to create aliases for a class. """
    def __new__(cls, classname, bases, attrs):
        class_ = type(classname, bases, attrs)
        globals().update({alias: class_ for alias in attrs.get('aliases', [])})
        return class_

class C(object):
    __metaclass__ = AKA
    aliases = 'C1', 'C2'

print(C)          # <class '__main__.C'>
print(C.aliases)  # ('C1', 'C2')
print(C1)         # <class '__main__.C'>
print(C2)         # <class '__main__.C'>

```

**Note:** In Python 3.x the syntax for specifying a metaclass is different and would need to be:

```
class C(metaclass=AKA):
    aliases = 'C1', 'C2'

```
It's a bad idea, but it can be done with an abuse of class decorators:

```
def aliaser(cls):
    for alias in cls.aliases:
        globals()[alias] = cls
    return cls

@aliaser
class LongName(object):
    aliases = ['LN', 'Ugh']

>>> LN
<class '__main__.LongName'>

```

This is an abuse because the point of decorators is to modify the object they decorate, but this one is used only for its global side-effect of assigning additional names in the global namespace that point to the same class.

Use at your own risk! ;-)