PDA

View Full Version : Would it be possible to do this with .htaccess?



Ryan Fitton
08-15-2010, 07:31 PM
Hi all, i have some pages that i want to use .htaccess on, the file names are below:

photos_something.php

Would it be possible to make them appear as:
/photos/something.php

so they would appear in a doman as:
http://www.domain.co.uk/photos/something.php

instead of:
http://www.domain.co.uk/photos_something.php

Thanks very much, Ryan.

Ryan Fitton
08-17-2010, 11:25 AM
Anyone? :confused:

Beverleyh
08-17-2010, 02:30 PM
I dont really know much about .htaccess myself but this old forum post might help: http://www.webmasterworld.com/forum92/2545.htm

djr33
08-17-2010, 04:54 PM
Yes, it's very possible. You won't find that exact situation anywhere, but you can adapt a similar situation (really, most mod_rewrite setups are similar), and just update the regex patterns in it for your specific setup.
Alternatively you could look at my tutorial in the coding tips section, though it's a little complex. What it does is moves the redirect to PHP, so if you know PHP well but not .htaccess, it is easier.

Beverleyh
08-17-2010, 05:25 PM
I forgot about your tutorial so thanks for reminding me. I think it could be useful to my next project.

BTW - your external php javascript/CSS files tutorial has been most useful to me too.

djr33
08-17-2010, 05:41 PM
Ah, that's from a long time ago. Glad it's still useful. That reminds me to add that one also to the PHP scripts site currently in development.

Beverleyh
08-17-2010, 10:05 PM
Yes, it looks like its coming along well. I have a few small snippets to contribute that I hope will be useful too.

Ryan Fitton
08-18-2010, 12:06 PM
Thanks for the reply :)