LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   .htaccess headache (https://www.linuxquestions.org/questions/linux-server-73/htaccess-headache-4175432940/)

amdowney 10-18-2012 03:16 PM

.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]


bathory 10-18-2012 04:39 PM

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

amdowney 10-19-2012 04:11 AM

Thanks but I'm stil getting a 'webpage not found' error with that?

bathory 10-19-2012 06:23 AM

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


All times are GMT -5. The time now is 10:06 AM.