Forum Moderators: phranque

Message Too Old, No Replies

Images disappear in IE with .htaccess rewrite

Very new to .htaccess and mod_rewrite

         

raybb

7:30 pm on Jan 7, 2010 (gmt 0)

10+ Year Member



I recently upgraded a website (www.example.com) that I manage to use Joomla. I also use Squirrelcart and VBulletin. Each installed in their own folders /joomla, /store, and forum respectively. I want the home page to be the Joomla site but do not want the customer to see the Joomla folder name in the URL. In other words all that would show ni the address bar is "http://example.com". I have figured out how to do that no problem. I have also figured out how to make the links to the Store and Forum pages work. My problem is with the store. Once you land on the main store page the images and main content will disappear after a couple of seconds (The Joomla and Forum pages work fine). Here is what I am using for my .htaccess file in the root of the site:

#######################################################

Options +FollowSymLinks
RewriteEngine On
RewriteBase /

# This section must come first!
# Add trailing slash if path does not contain a period or end with a slash
RewriteCond %{REQUEST_URI} !(\.¦/$)
RewriteRule (.*) http://www.example.com/$1/ [R=301,L]

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

#Rewrites http://www.example.com/subdir to http://www.example.com/
RewriteCond %{REQUEST_URI} !^/joomla
RewriteRule ^(.*)$ joomla/$1 [L]
RewriteCond %{REQUEST_URI} !^/store
RewriteRule ^(.*)$ store/$1 [L]
RewriteCond %{REQUEST_URI} !^/forum
RewriteRule ^(.*)$ forum/$1 [L]

##########################################################

For the .htaccess file in the "store" folder I am using this:

##########################################################

Options +FollowSymLinks
Options -MultiViews
RewriteEngine On
RewriteRule ^(products¦categories¦news¦reviews¦testimonials)/?(.*)$ store.php/$1
/$2 [L]

############################################################

I am sure the second .htaccess file is not entirely correct but I am real new to this and not sure where to start. Any help would be greatly appreciated!

Thanks
Ray

[edited by: jdMorgan at 12:20 am (utc) on Jan. 8, 2010]
[edit reason] example.com [/edit]

raybb

7:31 pm on Jan 7, 2010 (gmt 0)

10+ Year Member



One other quick note. The problem only occurs when using IE as your browser. Firefox works fine.

Ray

g1smd

12:07 am on Jan 8, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Your three rewrites want to match "everything" in URL requests.

Only one of those can match. You need a much more specific pattern to match the incoming URL request so that only the correct RewriteRule is selected.

You'll also need to redirect external client requests that ask for URLs that include the folder name to make a new request for the new URL. Failure to do so means that both URLs will serve the same content.

jdMorgan

12:23 am on Jan 8, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It looks like it would be advisable to ask which of the following two paths is the URL requested by the browser, and which is the physical filepath to be accessed on the server?

example.com/
example.com/joomla

Jim

raybb

12:41 am on Jan 8, 2010 (gmt 0)

10+ Year Member



You are right my statements were not very well written. I have done some more reading and now have this in my .htaccess atthe root of my site:

##################################################################

Options +FollowSymLinks
RewriteEngine On
RewriteBase /

# This section must come first!
# Add trailing slash if path does not contain a period or end with a slash
RewriteCond %{REQUEST_URI} !(\.¦/$)
RewriteRule (.*) [partsmike.com...] [R=301,L]

#Change [yoursite.com...] to [yoursite.com...] (Optional)
RewriteCond %{HTTP_HOST} ^partsmike.com$
RewriteRule ^/?(.*)$ [partsmike.com...] [R=301,L]

#Rewrites [yoursite.com...] to [yoursite.com...]
RewriteCond $1 !^(store¦forum¦css¦stats)
RewriteRule ^(.*)$ joomla/$1 [L]

####################################################################

This allowed me to remove the .htaccess files in all the other folders but my problem still exists with IE only(I am using IE7 but IE6 has the problem too).

The actual files for the main page are in "partsmike.com/joomla" (actuall file location) which I am redirecting to simply "partsmike.com". The problem is with how the forums page is displayed. Those files are under "partsmike.com/forum" (actuall file location). I hope that answers both of your questions.

Thanks!
Ray

raybb

12:44 am on Jan 8, 2010 (gmt 0)

10+ Year Member



I should also mention that not all of the CSS formating is there for the parts that do show when going to the forum page. www.partsmike.com/forum :(

Ray

raybb

5:22 am on Jan 8, 2010 (gmt 0)

10+ Year Member



Looks like I figured out my problem. I thought my problem was due to enabling mo)rewrite and introducing .htaccess files. Since that was the last thing I did before things went wrong. I have now validated that this is strictly a problem with IE7 and older IE browsers. Firefox and Safari are fine. Sorry for the false alarm.

That being said given the latest posting of what I have in my .htacces file does anyone see any improvments I can make?

Thanks!
Ray