Server Administration
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsOther TechnologiesServer Administration

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
  #1  
Old April 9th, 2008, 12:20 PM
qali qali is offline
Contributing User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 89 qali User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 28 m 18 sec
Reputation Power: 2
*nix - Mod_rewrite

hi

I have inherited a project with some mod_rewrite code that I do not really undertsand. The site works fine unless a slash is missing at the end of the URL.

Most of the the .htaccess script works but it does NOT add a trailing slash at the end of my urls if it is missing and I keep getting 'page cannot be found'.
To me, the first 3 lines should add a trainling slash to the URL but it does not seem to work.

For info, the site is all DB driven and none of the URLs I try to connect do exists on the server.

I need the .htaccess to make sure there is a '/' at then of all urls

Code:
RewriteCond %{REQUEST_URI} !/$
RewriteCond %{REQUEST_URI} !\.
RewriteRule (.*) /$1/ [R=301,L]

RewriteCond %{REQUEST_URI} ^/main_folder/$
RewriteRule ^(.*)$ /main_folder/_base.php [L,QSA]

RewriteCond %{REQUEST_URI} ^/main_folder/assets/css/language.css$
RewriteRule ^(.*)$ /main_folder/_base.php [L,QSA]

RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /main_folder/_base.php [L,QSA]


_base.php is the file that processes the urls


If I change the first 3 lines with
Code:
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteCond %{REQUEST_URI} !(.*)\.
RewriteRule (.*) http://mydomain/main_folder/$1/ [R=301,L]

then it works within the site. But I still get a page cannot be found with 'http://mydomain/main_folder' as it is not dealt with.

Reply With Quote
Reply

Viewing: Codewalkers ForumsOther TechnologiesServer Administration > *nix - Mod_rewrite


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway