Jump to content

dynamically generated .htaccess


HaLo2FrEeEk

Recommended Posts

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?

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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. :)

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

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.