pgrevents Posted May 13, 2009 Share Posted May 13, 2009 I think thats the right heading for what I am about to ask 1st q: Change filetype? Is it possible to change the lets say index.php to index.whateveriwant 2nd q: i have the a my rewrite rule in the htdocs folder if a user sets www.iamdj.co.uk/djname it will do this www.iamdj.co.uk/dj/display/djname now I already have this working but what I want is if someone goes to www.iamdj.co.uk it displays the index.php file instead of transfering. I have tried to fiddle about but since I donot know much about mod rewrite I thought I would as how these are done. I have tried google etc and I am not finding what I am wanting to know. Thanks peeps Link to comment https://forums.phpfreaks.com/topic/158034-change-filetype-and-ignore-if-var-isnt-set/ Share on other sites More sharing options...
gffg4574fghsDSGDGKJYM Posted May 13, 2009 Share Posted May 13, 2009 1st q: Change filetype? Is it possible to change the lets say index.php to index.whateveriwant Yes just add another type in .htaccess/apache config like that : AddHandler application/x-httpd-php .php You can use any extension you want and all file with that extension will be processed as if it was a php You can use FilesMatch too like this : <FilesMatch "\.(css|style)$"> SetHandler application/x-httpd-php </FilesMatch> Will process file with .css and .style as php file. 2nd q: i have the a my rewrite rule in the htdocs folder if a user sets www.iamdj.co.uk/djname it will do this www.iamdj.co.uk/dj/display/djname now I already have this working but what I want is if someone goes to www.iamdj.co.uk it displays the index.php file instead of transfering. What exactly are you trying to do ? Link to comment https://forums.phpfreaks.com/topic/158034-change-filetype-and-ignore-if-var-isnt-set/#findComment-833629 Share on other sites More sharing options...
pgrevents Posted May 13, 2009 Author Share Posted May 13, 2009 What I am trying to do on the second q is just say user types in www.iamdj.co.uk the user will be presented with the main page www.iamdj.co.uk/index.php BUT if a user types in www.iamdj.co.uk/djname the user is taken to www.iamdj.co.uk/dj/index.php?display=djname or www.iamdj.co.uk/dj/display/djname regarding q1 I take it I would need direct access to the appache config file? thanks Link to comment https://forums.phpfreaks.com/topic/158034-change-filetype-and-ignore-if-var-isnt-set/#findComment-833637 Share on other sites More sharing options...
gffg4574fghsDSGDGKJYM Posted May 13, 2009 Share Posted May 13, 2009 regarding q1 I take it I would need direct access to the appache config file? I'm not sure about your configuration but i think not, you should be able to put it in a .htaccess. For the others question you can use this : Options +FollowSymLinks <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteRule .....some rules....... </IfModule> RewriteCond %{REQUEST_FILENAME} !-f will prevent the rewriterule to work if the file exist, like php, image, css, javascript and if not file exist with that name use the rewriterule. Link to comment https://forums.phpfreaks.com/topic/158034-change-filetype-and-ignore-if-var-isnt-set/#findComment-833661 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.