homepage Welcome to WebmasterWorld Guest from 54.242.200.172
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Subscribe to WebmasterWorld
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

    
htaccess woes
can't get some htaccess syntax right
oilman




msg:4107913
 12:00 am on Apr 1, 2010 (gmt 0)

been gone a long time - back to ask for help :)

This htaccess code is causing 500 errors.

It works fine when it's just the CDSEO code. When I add in the bb_Store stuff on and the nonwww stuff it breaks. Any ideas?


DirectoryIndex home.php index.html index.php

# Enable mod rewrite engine
RewriteEngine On

#Matches old bb_store urls and redirects to same url without bb_store
RewriteRule ^bb_store/catalog/(.*)$ http://www.example.com/catalog/$1 [R=301,L]

#Redirects nonwww to www
RewriteEngine On
RewriteCond %{HTTP_HOST} !^(www\.example\.com)?$
RewriteRule (.*) http://www.example.com/$1 [R=301,L]

# ------------------------------------
# CDSEO Pro
# ------------------------------------
# This directory index is recommended to replace the
# x-cart default within this .htaccess file

# .htpasswd protection
# May be required if your htpasswd files are located below document root
(i.e. cpanel)
# Remove # at the beginning of this line if your unable to access password
protected folders:
ErrorDocument 401 "Unauthorized"

# Some servers require this Options directive to be disabled
# Remove # at the beginning of this line to disable:
#Options -Multiviews

# Some servers require the Rewritebase directive to be enabled
# Remove # at the beginning of this line to enable:
RewriteBase /

RewriteCond %{REQUEST_URI} !^/(payment|admin|provider|partner)/
RewriteCond %{REQUEST_FILENAME} !\.(gif|jpe?g|png|js|css|swf|php|ico)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.+)$ cdseopro.php
# ------------------------------------
# / CDSEO Pro
#

 

g1smd




msg:4107954
 1:25 am on Apr 1, 2010 (gmt 0)

You have
RewriteEngine On twice.

The
RewriteBase / can be removed as that is the default.

The final RewriteRule (the rewrite) needs an [L] flag, but can't see a lot else to fix.


Do make sure that all of your comment lines do begin with the # mark.
Some appear not to do so, but that might just be the forum wrapping the lines.

jdMorgan




msg:4108362
 3:37 pm on Apr 1, 2010 (gmt 0)

It appears that you may need to exclude the "catalog" path from your cdseopro rewriterule by adding it to the first RewriteCond in your last rule above.

Jim

oilman




msg:4108450
 6:13 pm on Apr 1, 2010 (gmt 0)

Like so?

DirectoryIndex home.php index.html index.php

# Enable mod rewrite engine
RewriteEngine On

#Matches old bb_store urls and redirects to same url without bb_store
RewriteRule ^bb_store/catalog/(.*)$ http://www.example.com/catalog/$1 [R=301,L]

#Redirects nonwww to www
RewriteCond %{HTTP_HOST} !^(www\.example\.com)?$
RewriteRule (.*) http://www.example.com/$1 [R=301,L]

# ------------------------------------
# CDSEO Pro
# ------------------------------------
# This directory index is recommended to replace the
# x-cart default within this .htaccess file

# .htpasswd protection
# May be required if your htpasswd files are located below document root
(i.e. cpanel)
# Remove # at the beginning of this line if your unable to access password
protected folders:
ErrorDocument 401 "Unauthorized"

# Some servers require this Options directive to be disabled
# Remove # at the beginning of this line to disable:
#Options -Multiviews

# Some servers require the Rewritebase directive to be enabled
# Remove # at the beginning of this line to enable:

RewriteCond %{REQUEST_URI} !^/(payment|admin|provider|partner|catalog)/
RewriteCond %{REQUEST_FILENAME} !\.(gif|jpe?g|png|js|css|swf|php|ico)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.+)$ cdseopro.php [L]
# ------------------------------------
# / CDSEO Pro
#

g1smd




msg:4108458
 6:17 pm on Apr 1, 2010 (gmt 0)

Looks good.

oilman




msg:4110310
 7:14 pm on Apr 5, 2010 (gmt 0)

didn't work. I'm guessin some conflict somehow. Really wishing I had server access :(

g1smd




msg:4110317
 7:38 pm on Apr 5, 2010 (gmt 0)

Don't let jdMorgan see that too-vague-to-be-useful "didn't work" report. :)

What was the test URL (use example.com to mask the real domain name)?
What was supposed to happen?
What actually happened?
How did that differ from what was expected?
What did you see when using Live HTTP Headers to examine the HTTP transaction?
What do the server error logs say?

jdMorgan




msg:4110789
 2:50 pm on Apr 6, 2010 (gmt 0)

@g1smd: :)

@oil: Be sure to delete your browser cache before testing any new code.

Jim

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
© Webmaster World 1996-2014 all rights reserved