views:

46

answers:

1

Hello,

On my website I have an affiliates/ folder.

Inside that I have showgames.php

I want to be able to access the file as www.website.com/affiliates/showgames.aff

Inside affiliates folder,I placed this .htaccess

AddType application/x-httpd-php .php .aff
RewriteEngine on
RewriteBase /
RewriteRule ^(.*)\.php$ $1.aff [R=permanent]

For some reasons , it doesnt work .

A: 

You misunderstand what rewriting is.

You say you have a /affiliates/showgames.php page that you want to be accessible as /affiliates/showgames.aff. This means the second must be internally rewritten to the first when it's requested, not the other way around.

This also means that you do not need to interpret .aff files as PHP scripts. Just do this in affiliates' .htaccess:

RewriteRule ^(.*)\.aff$ $1.php [QSA]
Artefacto
not working ... what does Q ,S and A mean ? I tried to add only that line in affiliates htaccess and didnt work
nevergone
See http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html QSA means "query string append". If it didn't work, perhaps you need `RewriteEngine on`. Otherwise, you have to be more specific than "didn't work"
Artefacto
I got it working finally , after adding RewriteEngine onRewriteRule ^(.*)\.aff$ $1.php [QSA]Thx
nevergone