War Room

Go Back   WarriorForum - Internet Marketing Forums > Warrior Support Forums > Programming Talk

Featured Warrior Special Offer...
"Members Of The *War Room* Discover Secrets To Immediate Success!"
Reply
 
LinkBack Thread Tools
Old 04-07-2009, 07:24 AM   #1
www.linkabyss.com
War Room Member
 
AndyBlackSEO's Avatar
 
Join Date: Oct 2007
Location: , , United Kingdom.
Posts: 833
Thanks: 18
Thanked 71 Times in 60 Posts
Default URL Mod Rewrite Question...

Hi,

I am having problems getting a mod rewrite on my .htaccess file to work.

I have added the following code to the file........

Options +FollowSymLinks
RewriteEngine on

RewriteRule product-product-(.*)\.php product.php?product=$1

The original url is something like....

http://www.mysite.co.uk/product.php?...%20highlighter

and I want the url to rewrite to..........

Example: http://www.mysite.co.uk/product-prod...ighlighter.php

I have used a website tool to create this rewrite. Is there a reason this wouldn't work?

Ideally, i'd like to rewrite the over url to something like.........

http://www.mysite.com/product/Malmo-...th-highlighter

I also have another url to rewrite to something like.......

http://www.mysite.com/category/Highlighter-Pens

Could anyone point me in the right direction of how I could do this?

Any help would be greatly appreciated!

Many thanks

Andy

NEW Online Article Creator! Now includes brand NEW content research feature!
FREE Article Rewriting Tool - Rewrite Existing Articles With Ease! Brand NEW Tool
Just Launched! Brand NEW SEO Software
Launching Soon! Link ABYSS One Way Link Building System - Offering Full Control And Flexibility Of Where You Obtain Your Links
AndyBlackSEO is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 04-07-2009, 08:33 AM   #2
HyperActive Warrior
 
ehicks727's Avatar
 
Join Date: Mar 2009
Posts: 226
Thanks: 6
Thanked 27 Times in 27 Posts
Default Re: URL Mod Rewrite Question...

Quote:
Originally Posted by AndyBlackSEO View Post
RewriteRule product-product-(.*).php product.php?product=$1
First of all, I don't know why you have product in the matching URL twice... that's kind of awkward. Anyway, try something like this... I don't know if this will work or not btw, I'm not a mod_rewrite wizard... I just search and experiment until I find my answers.

RewriteRule ^product-product-(.*)$ /product.php?product=$1


As far as...
Quote:
Originally Posted by AndyBlackSEO View Post
Ideally, i'd like to rewrite the over url to something like.........

http://www.mysite.com/product/Malmo-...th-highlighter
You have to do that in your code. In pseudo-code, it would look like this...

1. rewrite the url
2. grab what ever is after "product/"
3. check the database for a match
4. if it doesn't match, display 404
5. if it does match, display page
ehicks727 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 04-07-2009, 09:30 AM   #3
www.linkabyss.com
War Room Member
 
AndyBlackSEO's Avatar
 
Join Date: Oct 2007
Location: , , United Kingdom.
Posts: 833
Thanks: 18
Thanked 71 Times in 60 Posts
Default Re: URL Mod Rewrite Question...

Thanks ehics,

Unfortunately that doesn't do anything. Whatever I seem to add just has no effect on anything.

I contact my host last week and they said all I had to do was add the correct code to the .htaccess file which I have done. Nothing else needs to be 'turned on' according to them.

I'm a bit stuck. If it changed something then at least i'd know I was on the right track but whatever I add to the .htaccess file, it doesn't make the blindest bit of difference.

Andy

NEW Online Article Creator! Now includes brand NEW content research feature!
FREE Article Rewriting Tool - Rewrite Existing Articles With Ease! Brand NEW Tool
Just Launched! Brand NEW SEO Software
Launching Soon! Link ABYSS One Way Link Building System - Offering Full Control And Flexibility Of Where You Obtain Your Links
AndyBlackSEO is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 04-07-2009, 07:47 PM   #4
Philipp Kostin
War Room Member
 
Philarmon's Avatar
 
Join Date: Sep 2006
Location: Planet Earth
Posts: 53
Thanks: 8
Thanked 3 Times in 3 Posts
Default Re: URL Mod Rewrite Question...

Just took a quick look on how my rewrites look like (i'm not a htaccess guru as well )

Looks a bit different - maybe you want to try it out:

RewriteRule ^product-product-([^-]*).php$ /product.php?product=$1 [L]

Note that there is no "\" before the .php

Not sure but it might be the spaces in the product name that are causing problems ? I never have any spaces in an URL.

Another option would be to track the products with an id and add the product name just for the SEO purposes. Let's say the product id in your database is 556. Within your product name, replace all spaces with "-" before you add it to the URL so the URL looks like this:

http://www.mysite.com/product/556-Ma...th-highlighter

Then this rewrite would definately do the job:

RewriteRule ^product-product/([0-9]*)-([^-]*)$ /product.php?id=$1 [L]

Then just get the product data by id rather than by product name within your product.php script (should be faster to get a int rather than varchar from the database as well)

Hope that helps
Philarmon is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 04-08-2009, 05:23 AM   #5
www.linkabyss.com
War Room Member
 
AndyBlackSEO's Avatar
 
Join Date: Oct 2007
Location: , , United Kingdom.
Posts: 833
Thanks: 18
Thanked 71 Times in 60 Posts
Default Re: URL Mod Rewrite Question...

Hi thanks! I'll try that out now. I would normally use an id, but because I wanted to use the product name or category name within the url I setup the system this way. As I programmed my system to not add duplicate product names I thought this would be ideal for SEO.

I'll give your url syntax a go and see what happens.

Thanks!

Andy

NEW Online Article Creator! Now includes brand NEW content research feature!
FREE Article Rewriting Tool - Rewrite Existing Articles With Ease! Brand NEW Tool
Just Launched! Brand NEW SEO Software
Launching Soon! Link ABYSS One Way Link Building System - Offering Full Control And Flexibility Of Where You Obtain Your Links
AndyBlackSEO is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 04-08-2009, 05:29 AM   #6
www.linkabyss.com
War Room Member
 
AndyBlackSEO's Avatar
 
Join Date: Oct 2007
Location: , , United Kingdom.
Posts: 833
Thanks: 18
Thanked 71 Times in 60 Posts
Default Re: URL Mod Rewrite Question...

Just tried that and there is no difference to the displayed url at all. I'll spend the rest of the day trying to work this out otherwise i'll just get the site indexed with dynamic urls... which isn't what I wanted to do.

If you have any other ideas why it is not noticing the rewrite i'd love to hear them.

Thanks

Andy

NEW Online Article Creator! Now includes brand NEW content research feature!
FREE Article Rewriting Tool - Rewrite Existing Articles With Ease! Brand NEW Tool
Just Launched! Brand NEW SEO Software
Launching Soon! Link ABYSS One Way Link Building System - Offering Full Control And Flexibility Of Where You Obtain Your Links
AndyBlackSEO is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 04-08-2009, 09:59 AM   #7
www.linkabyss.com
War Room Member
 
AndyBlackSEO's Avatar
 
Join Date: Oct 2007
Location: , , United Kingdom.
Posts: 833
Thanks: 18
Thanked 71 Times in 60 Posts
Default Re: URL Mod Rewrite Question...

My host said that I can't just do a mod rewrite using the .htaccess. He said with it using a mySQL databse I have to set the rule in the mySQL queries?!

Does anybody understand this or steer me in the right direction. I'm stuck.

Thanks

Andy

NEW Online Article Creator! Now includes brand NEW content research feature!
FREE Article Rewriting Tool - Rewrite Existing Articles With Ease! Brand NEW Tool
Just Launched! Brand NEW SEO Software
Launching Soon! Link ABYSS One Way Link Building System - Offering Full Control And Flexibility Of Where You Obtain Your Links
AndyBlackSEO is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 04-09-2009, 10:30 AM   #8
www.linkabyss.com
War Room Member
 
AndyBlackSEO's Avatar
 
Join Date: Oct 2007
Location: , , United Kingdom.
Posts: 833
Thanks: 18
Thanked 71 Times in 60 Posts
Default Re: URL Mod Rewrite Question...

Thanks Guys, but i've managed to sort everything now :-)

NEW Online Article Creator! Now includes brand NEW content research feature!
FREE Article Rewriting Tool - Rewrite Existing Articles With Ease! Brand NEW Tool
Just Launched! Brand NEW SEO Software
Launching Soon! Link ABYSS One Way Link Building System - Offering Full Control And Flexibility Of Where You Obtain Your Links
AndyBlackSEO is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

  WarriorForum - Internet Marketing Forums > Warrior Support Forums > Programming Talk

Tags
mod, question, rewrite, url

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



All times are GMT -6. The time now is 09:24 AM.