Author Topic: .htaccess example for use with VM2 & J2.5  (Read 9612 times)

optmax

  • Jr. Member
  • **
  • Posts: 96
.htaccess example for use with VM2 & J2.5
« on: February 14, 2013, 17:52:55 pm »
Are there any example .htaccess files for use with VM2/J!2.5?
If so could someone point me in the right direction?
Thanks

jjk

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 3648
  • using Matomo instead of Google Analytics
Re: .htaccess example for use with VM2 & J2.5
« Reply #1 on: February 14, 2013, 19:37:53 pm »
I never had to change the .htaccess supplied with the Joomla installation. But if it doesn't work, the mod_rewrite-module might not be enabled in your server configuration by default. In this case you might be able to turn it on in your cpanel or whatever interface is installed on your server.
Non-English Shops: Are your language files up to date?
http://virtuemart.net/community/translations

optmax

  • Jr. Member
  • **
  • Posts: 96
Re: .htaccess example for use with VM2 & J2.5
« Reply #2 on: February 14, 2013, 22:27:34 pm »
Ok so am I just being paranoid?
http://docs.joomla.org/Htaccess_examples_(security)
has a much more comprehensive .htaccess than the default (but it is dated two years ago).
I installed it but it has broken some functionaity - particularly the Rupostel One Page Checkout component,

jjk

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 3648
  • using Matomo instead of Google Analytics
Re: .htaccess example for use with VM2 & J2.5
« Reply #3 on: February 15, 2013, 10:13:12 am »
Ok so am I just being paranoid?
I don't know - I'm not a security expert. My feeling is that such long individual htaccess files are more relevant for users who operate their own server. But what you will certainly need when your shop goes life, is a tool that prevents spambots using VM2's 'Ask a question about this product'. This one for example works pretty well:
http://extensions.joomla.org/extensions/access-a-security/site-security/captcha/11964
And don't forget to use a strong password for the backend - (This week I've already seen two life shops which were still using the Joomla default username/password)
Non-English Shops: Are your language files up to date?
http://virtuemart.net/community/translations

PRO

  • Global Moderator
  • Super Hero
  • *
  • Posts: 10406
  • VirtueMart Version: 3+
Re: .htaccess example for use with VM2 & J2.5
« Reply #4 on: February 15, 2013, 12:48:22 pm »
I use akeebah admin tools to create htaccess

It also has added security features.

J3.9+ VM 3.4.2
Slowest Page Speed Score (88) (Category)
Fastest Page Speed Score (94-96) (productdetails)

optmax

  • Jr. Member
  • **
  • Posts: 96
Re: .htaccess example for use with VM2 & J2.5
« Reply #5 on: February 18, 2013, 12:56:39 pm »
Thanks for the info and suggestions - very useful pointers.
I had made a find and replace typo when updating the .htaccess file I installed and now I have corrected it my store is working again.

Peter Pillen

  • Jr. Member
  • **
  • Posts: 223
Re: .htaccess example for use with VM2 & J2.5
« Reply #6 on: March 03, 2013, 00:07:35 am »
I'm curious about tweaks that other people have done as well. I personally added following things to the htaccess file

RewriteCond %{HTTP_HOST} ^mysite.com [NC]
RewriteRule (.*) http://www.mysite.com/$1 [L,R=301]
-> with or without the "www" in the url

then

# nl sitemap
RewriteCond %{REQUEST_URI} ^/nl/sitemap.xml
RewriteRule .* /index.php?option=com_xmap&view=xml&tmpl=component&id=1
#of
RewriteCond %{REQUEST_URI} ^/sitemap.xml
RewriteRule .* /index.php?option=com_xmap&view=xml&tmpl=component&id=1
# fr sitemap
RewriteCond %{REQUEST_URI} ^/fr/sitemap.xml
RewriteRule .* /index.php?option=com_xmap&view=xml&tmpl=component&id=3&lang=fr
# en sitemap
RewriteCond %{REQUEST_URI} ^/en/sitemap.xml
RewriteRule .* /index.php?option=com_xmap&view=xml&tmpl=component&id=4&lang=en
-> because when using xmap, some search bots only look for files with the name "sitemap" and adding this feature, redirects every sitemap search to the corresponding xmap url for every different language

then (because my hosting does not gzip or anything like that ... I made a gzipped version of every frequently downloaded js and css file to make this work)

  <IfModule mod_headers.c>
    # Serve gzip compressed CSS files if they exist and the client accepts gzip.
    RewriteCond %{HTTP:Accept-encoding} gzip
    RewriteCond %{REQUEST_FILENAME}\.gz -s
    RewriteRule ^(.*)\.css $1\.css\.gz [QSA]

    # Serve gzip compressed JS files if they exist and the client accepts gzip.
    RewriteCond %{HTTP:Accept-encoding} gzip
    RewriteCond %{REQUEST_FILENAME}\.gz -s
    RewriteRule ^(.*)\.js $1\.js\.gz [QSA]

    # Serve correct content types, and prevent mod_deflate double gzip.
    RewriteRule \.css\.gz$ - [T=text/css,E=no-gzip:1]
    RewriteRule \.js\.gz$ - [T=text/javascript,E=no-gzip:1]
    RewriteRule \.js\.gz$ - [T=application/javascript,E=no-gzip:1]

    <FilesMatch "(\.js\.gz|\.css\.gz)$">
      # Serve correct encoding type.
      Header set Content-Encoding gzip
     Header set Cache-Control "max-age=2592000, proxy-revalidate"
      # Force proxies to cache gzipped & non-gzipped css/js files separately.
      Header append Vary Accept-Encoding
    </FilesMatch>
   
   # add cache control headers to image files of 2 weeks
   <filesMatch "\.(ico|flv|jpg|jpeg|png|gif|swf)$">
      Header set Cache-Control "max-age=1209600, public"
   </filesMatch>
     ExpiresActive on
   ExpiresByType image/jpeg A2592000
   ExpiresByType image/jpg A2592000
   ExpiresByType image/gif A2592000
   ExpiresByType image/png A2592000
   ExpiresByType image/x-icon A2592000
  </IfModule>
-> This code looks in the same file directory with every Http request for a gzipped filed and if it exists and the browser of the visitor accepts gzip... the gzipped file is returned. And finally add cache control headers to all files that don't have cache headers set.

lindapowers

  • Full Member
  • ***
  • Posts: 1335
  • If you're going through hell, keep going.
    • Los Angeles immigration lawyers
  • Skype Name: manu.gonzalez91
  • VirtueMart Version: Latest avi
Re: .htaccess example for use with VM2 & J2.5
« Reply #7 on: April 28, 2013, 09:33:34 am »
# nl sitemap
RewriteCond %{REQUEST_URI} ^/nl/sitemap.xml
RewriteRule .* /index.php?option=com_xmap&view=xml&tmpl=component&id=1
#of
RewriteCond %{REQUEST_URI} ^/sitemap.xml
RewriteRule .* /index.php?option=com_xmap&view=xml&tmpl=component&id=1
# fr sitemap
RewriteCond %{REQUEST_URI} ^/fr/sitemap.xml
RewriteRule .* /index.php?option=com_xmap&view=xml&tmpl=component&id=3&lang=fr
# en sitemap
RewriteCond %{REQUEST_URI} ^/en/sitemap.xml
RewriteRule .* /index.php?option=com_xmap&view=xml&tmpl=component&id=4&lang=en
-> because when using xmap, some search bots only look for files with the name "sitemap" and adding this feature, redirects every sitemap search to the corresponding xmap url for every different language

Hi Peter

I'm curious about this. Didn't google webmaster tools allow you to send sitemap directly like this:

/fr/?option=com_xmap&view=xml&tmpl=component&id=1
/en/?option=com_xmap&view=xml&tmpl=component&id=1
/es/?option=com_xmap&view=xml&tmpl=component&id=1

For us it woks or that is what it seems cause it shows like 100  pages indexed in a sitemap of 140 links. 30 indexed for 40 links etc

We don't have anything added at .htaccess for the multilingual sitemaps but not all pages are getting indexed.

I notice you use a different ID for each sitemap, so basicly you have a sitemap for each language while what we have is the same sitemap for all languages but links are filtered per language. (as each menu item has its own language assigned)

Does that method work fine for you and showing all the links per sitemap indexed?

Regards

Peter Pillen

  • Jr. Member
  • **
  • Posts: 223
Re: .htaccess example for use with VM2 & J2.5
« Reply #8 on: April 28, 2013, 09:58:08 am »
This method works fine for me indeed. I was able to submit my sitemaps per language in google using the complete xmap url. But other search engines (and random spider bots) did not find the sitemap file. My website only got indexed by Google. Once I added the code for the different sitemaps in the htaccess file, other crawlers and spiders started indexing my site with more precision.

If using a different sitemap per language is a good choice? not sure ... but in my case I think it worked well. I have registred different domain extenions in fact. The french version mydomain.fr is forwarded to mydomain.be/fr/, mydomain.eu is forwarded to the english version mydomain.be/en/. It was a choice to have it working like this, but a good one? who knows  :)

lindapowers

  • Full Member
  • ***
  • Posts: 1335
  • If you're going through hell, keep going.
    • Los Angeles immigration lawyers
  • Skype Name: manu.gonzalez91
  • VirtueMart Version: Latest avi
Re: .htaccess example for use with VM2 & J2.5
« Reply #9 on: April 28, 2013, 12:50:27 pm »
This method works fine for me indeed. I was able to submit my sitemaps per language in google using the complete xmap url. But other search engines (and random spider bots) did not find the sitemap file. My website only got indexed by Google. Once I added the code for the different sitemaps in the htaccess file, other crawlers and spiders started indexing my site with more precision.

If using a different sitemap per language is a good choice? not sure ... but in my case I think it worked well. I have registred different domain extenions in fact. The french version mydomain.fr is forwarded to mydomain.be/fr/, mydomain.eu is forwarded to the english version mydomain.be/en/. It was a choice to have it working like this, but a good one? who knows  :)

Thanks a lot for reply, Ill google and read about it although there is a lack of information about multilingual sitemaps for joomla 2.5. Even the developer of Xmap doesn't know very well how to deal with it so imagine us.

I have not tested in other search engines yet but for now seems google is indexing, actually I'm starting to think that the sitemap is not even needed as we were indexed even before we submited the sitemaps.

Regards

Peter Pillen

  • Jr. Member
  • **
  • Posts: 223
Re: .htaccess example for use with VM2 & J2.5
« Reply #10 on: April 28, 2013, 13:54:25 pm »
Just my opninion... based on some research ... Keep in mind that sitemaps are possibly only used by spiders to find pages they were not able to find by regular crawling. They crawl your website and do a crosscheck with the sitemap. If all your important pages are reachable from your main page, most spiders can index your site perfectly without the sitemap. Using a different sitemap for each language comes in handy to see how many pages are indexed for each language (when checking your webmastertools you can clearly see # of indexed pages for each sitemap/language).

I've looked up my old todo-list for the reason why I adapted the htaccess file to rewrite url from sitemap.xml to xmap url and it was mainly because I got SEO warnings on different platforms saying that I didn't have a sitemap (xml or html) and was "penalized" for this. Not sure if it matters in any way, but better safe than sorry.