Jump to content

change filetype and ignore if var isnt set?


pgrevents

Recommended Posts

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
Share on other sites

 

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
Share on other sites

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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.