LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices



Reply
 
Search this Thread
Old 10-18-2012, 04:16 PM   #1
amdowney
LQ Newbie
 
Registered: Jan 2012
Posts: 6

Rep: Reputation: Disabled
Question .htaccess headache


Hi, I hope someone can help me on this..

Current site has URLS like www.x.com/prod/name.html

NEW URLS need to be www.x.com/Item/name (so loosing the .html

The thing is at the same time the .htacess is rewriting the Item URLS to the real php page with variables that remains hidden. Below is the code in place with first to RewriteRules doing the redirecting that I added. With these thought I just get a 500 server error?

Code:
Options +FollowSymLinks
RewriteEngine on

RewriteRule ^index.php - [L,PT]
RewriteRule ^$ index.php?COREseourl=/ [L,PT]
RewriteRule ^/$ index.php?COREseourl=/ [L,PT]
RewriteRule ^sitemap\.xml utilities/sitemap.xml [L,PT]
RewriteRule ^rss\.xml utilities/rss.xml [L,PT]
RewriteCond %{REQUEST_URI} ^/
RewriteCond %{REQUEST_URI} !\.(xml|css|js|gif|jpg|jpeg|png|pdf)$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*) index.php?COREseourl=/$1 [L,PT]


RewriteRule ^cat/(.*)\.html$ Category/$1 [R=301, L]
RewriteRule ^prod/(.*)\.html$ Item/$1 [R=301, L]
 
Old 10-18-2012, 05:39 PM   #2
bathory
Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 10,971

Rep: Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343
Hi,

Quote:
RewriteRule ^cat/(.*)\.html$ Category/$1 [R=301, L]
RewriteRule ^prod/(.*)\.html$ Item/$1 [R=301, L]
You should look at apache error_log to see why you get the 500 "Internal server error", but I guess it's because of the blank space before the "L" flag above. It should read:
Code:
RewriteRule ^cat/(.*)\.html$ Category/$1 [R=301,L]
RewriteRule ^prod/(.*)\.html$ Item/$1 [R=301,L]
Regards
 
Old 10-19-2012, 05:11 AM   #3
amdowney
LQ Newbie
 
Registered: Jan 2012
Posts: 6

Original Poster
Rep: Reputation: Disabled
Thanks but I'm stil getting a 'webpage not found' error with that?
 
Old 10-19-2012, 07:23 AM   #4
bathory
Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 10,971

Rep: Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343
Once again, check the apache error_log to see which rewrite rule is not working as expected, so it gives a non-existing URL
 
  


Reply

Tags
htaccess


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Headache! djbriuk General 16 01-27-2012 04:15 AM
I've had nothing but a headache with 13.37 hedron Slackware 24 10-25-2011 09:06 AM
postfix headache pedromel Linux - Server 6 04-14-2009 10:06 AM
Help im so new i have a headache jjh221 Linux - Newbie 3 02-11-2004 09:02 PM
headache... katana Linux - General 2 08-02-2001 08:44 AM


All times are GMT -5. The time now is 12:18 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration