HaLo2FrEeEk Posted October 15, 2009 Share Posted October 15, 2009 I tried goodle and it's failed me, or maybe I failed it, who knows. I was wondering if there was any way to dynamically generate an .htaccess file. The reason I want to know is so that I can use it to rewrite links for my forum to include the name of the topic in the url, for example: http://infectionist.com/forum/viewtopic/slow-motion-bullets.html instead of: http://infectionist.com/forum/viewtopic.php?t=1784 I know it's gotta be possible, and I know I could just do a simple rewrite to make the urls like this: http://infectionist.com/forum/view/topic1784.html But I want google to be able to crawl the url's better and cache the content more efficiently. Effectively I want to improve my site's SEO, and this will help. Can someone help me out? Quote Link to comment https://forums.phpfreaks.com/topic/177744-dynamically-generated-htaccess/ Share on other sites More sharing options...
HaLo2FrEeEk Posted October 15, 2009 Author Share Posted October 15, 2009 Ok wait, I just realized, the htaccess wouldn't have to be dynamically generated, I would just have to make the url something like this: http://infectionist.com/forum/view/topic1784/slow-motion-bullets.html That way the information it would get is from the view/topic1784, and the "filename" could be anything. I would control that from the php for the forum, not the htaccess, the only part that would really matter is the view/topic##, right? Quote Link to comment https://forums.phpfreaks.com/topic/177744-dynamically-generated-htaccess/#findComment-937201 Share on other sites More sharing options...
cags Posted October 15, 2009 Share Posted October 15, 2009 Yes. You could do it like that if you wanted. Technically speaking you don't have to include the topic id in the URL providing you ensure the end part of the URL is unique for each topic. For a forum though this will be hard to achieve, so you will be better off with your second suggestion to yourself. Quote Link to comment https://forums.phpfreaks.com/topic/177744-dynamically-generated-htaccess/#findComment-937312 Share on other sites More sharing options...
HaLo2FrEeEk Posted October 16, 2009 Author Share Posted October 16, 2009 For topics wouldn't I have to include the topic ID in the URL? The names can be fooled by having two topics with close enough names to each other, by having the topic ID in there it eliminates all possibility of it going to the wrong topic. For the forums I could just do the same thing: http://infectionistcom/view/forum1/infectionist_machinima_news.html And while we're on that subject is it better to use .html or .php as a file extension? I mean, I know it's all fake anyway, but I'm partial to using php, dunno why. Will it make a difference to search engines? Quote Link to comment https://forums.phpfreaks.com/topic/177744-dynamically-generated-htaccess/#findComment-937790 Share on other sites More sharing options...
trq Posted October 16, 2009 Share Posted October 16, 2009 For topics wouldn't I have to include the topic ID in the URL? The names can be fooled by having two topics with close enough names to each other, by having the topic ID in there it eliminates all possibility of it going to the wrong topic. That's exactly what cags just said. And while we're on that subject is it better to use .html or .php as a file extension? I mean, I know it's all fake anyway, but I'm partial to using php, dunno why. Will it make a difference to search engines? Makes no difference. Quote Link to comment https://forums.phpfreaks.com/topic/177744-dynamically-generated-htaccess/#findComment-937792 Share on other sites More sharing options...
HaLo2FrEeEk Posted October 16, 2009 Author Share Posted October 16, 2009 For topics wouldn't I have to include the topic ID in the URL? The names can be fooled by having two topics with close enough names to each other, by having the topic ID in there it eliminates all possibility of it going to the wrong topic. That's exactly what cags just said. No, he said "Technically speaking you don't have to include the topic id in the URL providing you ensure the end part of the URL is unique for each topic." I said "wouldn't I have to include the topic ID in the URL?" He said I didn't have to, I said I thought I did. I can't think of a way to make 2 similar or same names different, it wouldn't hurt anything to have the topic id included, so I'll just do that. And while we're on that subject is it better to use .html or .php as a file extension? I mean, I know it's all fake anyway, but I'm partial to using php, dunno why. Will it make a difference to search engines? Makes no difference. Good, I'll just use php then. Quote Link to comment https://forums.phpfreaks.com/topic/177744-dynamically-generated-htaccess/#findComment-937844 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.