Web Hosting Forum | Lunarpages


*
Welcome, Guest. Please login or register.
Did you miss your activation email?



Login with username, password and session length
February 08, 2012, 10:15:03 AM

Pages: [1]   Go Down
  Print  
Author Topic: .htaccess + mod_rewrite help - trying to rewrite URLs  (Read 1707 times)
RonRattie
Space Explorer
***
Offline Offline

Posts: 9


WWW
« on: June 03, 2009, 10:04:16 PM »

I'm trying to change URLs like www.somesite.com/index.php?page=1 to www.somesite.com/index.htm or www.somesite.com/this_is_a_seo_friendly_url/

I have this

RewriteCond %{QUERY_STRING} ^page=4$
RewriteRule ^contact\.html index.php?page=4 [L]

so far, but it doesn't do anything. I have scoured the net looking for information on how to do this correctly and I am fairly frustrated. Crying or Very sad

Anyone have an idea?
Logged

stillpixelstudios - no print, just pixels
Mitch
Berserker Poster
*****
Offline Offline

Posts: 12838


WWW
« Reply #1 on: June 04, 2009, 06:31:47 AM »

Hi Ron!

Are you using a specific script or CMS to control your site?
Logged

New to Web Site Hosting? Check Out the Lunarpages Blog Hosting Guide!


Follow us @lunarpages on Twitter!
Important Threads: Read This Before Posting! | Lunarforums Rules! | Mitch's Link of the Day!
Also, be sure to check out and subscribe to the Lunartics Blog and the Lunarpages Newsletter !

Need Web Hosting Help? Check out the Lunarpages Web Hosting Wiki. It has tons of tips, tutorials and resources!
MrPhil
Berserker Poster
*****
Offline Offline

Posts: 5081



« Reply #2 on: June 04, 2009, 08:49:40 AM »

You're going in the wrong direction. Links on your pages (as well as search engine entries and bookmarks/favorites) should be of the form index.htm. Your .htaccess file should be converting index.htm to index.php?page=1 via URL rewriting. There should be no "QUERY_STRING" in the incoming URL, just "index.htm".
Logged

RonRattie
Space Explorer
***
Offline Offline

Posts: 9


WWW
« Reply #3 on: June 04, 2009, 02:09:29 PM »

You're going in the wrong direction. Links on your pages (as well as search engine entries and bookmarks/favorites) should be of the form index.htm. Your .htaccess file should be converting index.htm to index.php?page=1 via URL rewriting. There should be no "QUERY_STRING" in the incoming URL, just "index.htm".

As is my nature, I posted the question but continued to search and experiment.  I have fixed/solved my problem.

RewriteEngine on
RewriteCond %{HTTP_HOST} ^pjsroofing.com [NC]
RewriteRule ^(.*)$ http://www.pjsroofing.com/$1
RewriteRule ^roof_replacement_and_roof_repair_specialists_serving_maryland_and_pennsylvania\.html index.php?page=1 [L]
RewriteRule ^we_specialize_in_roof_repairs_and_roof_replacement_using_quality_asphalt_cedar_and_metal_products\.html index.php?page=2 [L]
RewriteRule ^take_a_look_at_some_of_our_past_roof_repair_and_roof_replacement_projects\.html index.php?page=3 [L]
RewriteRule ^contact_pjsroofing_for_roof_replacement_or_roof_repairs\.html index.php?page=4 [L]
RewriteRule ^thank_you_for_contacting_pjsroofing_for_your_roof_replacement_or_roof_repairs\.html index.php?page=5 [L]

Quote
Are you using a specific script or CMS to control your site?

no specific scripts were used, just straight up PHP, HTML and CSS.

It is now live at http://www.pjsroofing.com  (a client who I referred to lunarpages from the other hosting company when I was redesigning the site).
Logged

stillpixelstudios - no print, just pixels
Mitch
Berserker Poster
*****
Offline Offline

Posts: 12838


WWW
« Reply #4 on: June 05, 2009, 04:17:23 AM »

Happy to hear it!   Thumbs Up
Logged

New to Web Site Hosting? Check Out the Lunarpages Blog Hosting Guide!


Follow us @lunarpages on Twitter!
Important Threads: Read This Before Posting! | Lunarforums Rules! | Mitch's Link of the Day!
Also, be sure to check out and subscribe to the Lunartics Blog and the Lunarpages Newsletter !

Need Web Hosting Help? Check out the Lunarpages Web Hosting Wiki. It has tons of tips, tutorials and resources!
RonRattie
Space Explorer
***
Offline Offline

Posts: 9


WWW
« Reply #5 on: June 05, 2009, 05:47:43 AM »

nice edit Mitch  Not Me
Logged

stillpixelstudios - no print, just pixels
Mitch
Berserker Poster
*****
Offline Offline

Posts: 12838


WWW
« Reply #6 on: June 05, 2009, 05:54:17 AM »

Hmmmm?   Confused
Logged

New to Web Site Hosting? Check Out the Lunarpages Blog Hosting Guide!


Follow us @lunarpages on Twitter!
Important Threads: Read This Before Posting! | Lunarforums Rules! | Mitch's Link of the Day!
Also, be sure to check out and subscribe to the Lunartics Blog and the Lunarpages Newsletter !

Need Web Hosting Help? Check out the Lunarpages Web Hosting Wiki. It has tons of tips, tutorials and resources!
RonRattie
Space Explorer
***
Offline Offline

Posts: 9


WWW
« Reply #7 on: June 05, 2009, 08:49:23 AM »

"from the other hosting company" <===  was not what I wrote.


* - edited this as an example

note the note under this...
« Last Edit: June 05, 2009, 11:06:22 AM by Mitch » Logged

stillpixelstudios - no print, just pixels
Mitch
Berserker Poster
*****
Offline Offline

Posts: 12838


WWW
« Reply #8 on: June 05, 2009, 11:05:38 AM »

"from the other hosting company" <===  was not what I wrote.

Very odd, wasn't edited by me, I'll show you on your previous post what comes up with I edit something.
Logged

New to Web Site Hosting? Check Out the Lunarpages Blog Hosting Guide!


Follow us @lunarpages on Twitter!
Important Threads: Read This Before Posting! | Lunarforums Rules! | Mitch's Link of the Day!
Also, be sure to check out and subscribe to the Lunartics Blog and the Lunarpages Newsletter !

Need Web Hosting Help? Check out the Lunarpages Web Hosting Wiki. It has tons of tips, tutorials and resources!
Mitch
Berserker Poster
*****
Offline Offline

Posts: 12838


WWW
« Reply #9 on: June 05, 2009, 11:06:58 AM »

"from the other hosting company" <===  was not what I wrote.

Very odd, wasn't edited by me, I'll show you on your previous post what comes up with I edit something.

« Last Edit: Today at 01:06:22 PM by Mitch »
Logged

New to Web Site Hosting? Check Out the Lunarpages Blog Hosting Guide!


Follow us @lunarpages on Twitter!
Important Threads: Read This Before Posting! | Lunarforums Rules! | Mitch's Link of the Day!
Also, be sure to check out and subscribe to the Lunartics Blog and the Lunarpages Newsletter !

Need Web Hosting Help? Check out the Lunarpages Web Hosting Wiki. It has tons of tips, tutorials and resources!
Mitch
Berserker Poster
*****
Offline Offline

Posts: 12838


WWW
« Reply #10 on: June 05, 2009, 11:07:49 AM »

Either way though, happy to hear you got it taken care of.  Applause
Logged

New to Web Site Hosting? Check Out the Lunarpages Blog Hosting Guide!


Follow us @lunarpages on Twitter!
Important Threads: Read This Before Posting! | Lunarforums Rules! | Mitch's Link of the Day!
Also, be sure to check out and subscribe to the Lunartics Blog and the Lunarpages Newsletter !

Need Web Hosting Help? Check out the Lunarpages Web Hosting Wiki. It has tons of tips, tutorials and resources!
Pages: [1]   Go Up
  Print  
 
Jump to: