Page 1 of 2 1 2 LastLast
Results 1 to 15 of 16

Help with moving from .htaccess to httpd.conf

This is a discussion on Help with moving from .htaccess to httpd.conf within the Troubleshooting forums, part of the vBSEO SEO Plugin category; I want to move my rewrite rules from my .htaccess to my httpd.conf, but I don't know exactly how to ...

  1. #1
    Member
    Real Name
    Santiago
    Join Date
    Sep 2006
    Location
    Argentina
    Posts
    74
    Liked
    0 times

    Help with moving from .htaccess to httpd.conf

    I want to move my rewrite rules from my .htaccess to my httpd.conf, but I don't know exactly how to do it...

    I know it must be like this:

    <Directory /path/to/my/forum>
    [insert rewrite rules here]
    </Directory>

    But I don't know if I need to change something of my .htaccess before...

    I hope someone can help me...

    Here is my .htaccess

    Code:
    RewriteEngine On
    
    RewriteCond %{HTTP_HOST} !^www\.elforro\.com$
    RewriteRule (.*) http://www.elforro.com/$1 [R=301,L]
    
    RewriteRule ^((urllist|sitemap_).*\.(xml|txt)(\.gz)?)$ vbseo_sitemap/vbseo_getsitemap.php?sitemap=$1 [L]
    
    RewriteCond %{QUERY_STRING} !vbseourl=
    RewriteCond %{REQUEST_URI} !(admincp/|modcp/|chat|cron)
    RewriteRule ^(.*\.php)$ vbseo.php?vbseourl=$1 [L,QSA]
    
    RewriteCond %{REQUEST_FILENAME} !\.(jpg|gif)$
    RewriteRule ^(archive/.*)$ vbseo.php?vbseourl=$1 [L,QSA]
    
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !^(admincp|modcp|clientscript|cpstyles|images)/
    RewriteRule ^(.+)$ vbseo.php?vbseourl=$1 [L,QSA]
    And this would be my path...

    Code:
    <Directory /www/elforro.com.ar/htdocs>
    [insert rewrite rules here]
    </Directory>

    I just want to know what changes should I made to my rewrite rules in order to work ok on my httpd.conf

    For ex. I think this lines won't work on httpd.conf
    Code:
    RewriteCond %{HTTP_HOST} !^www\.elforro\.com$
    RewriteRule (.*) http://www.elforro.com/$1 [R=301,L]

    Thanks in advance!

  2. #2
    vBSEO Staff Oleg Ignatiuk's Avatar
    Real Name
    Oleg Ignatiuk
    Join Date
    Jun 2005
    Location
    Belarus
    Posts
    25,689
    Liked
    157 times
    Hello,

    you should insert rewrite rules from .htaccess into <Directory> section without changes, then restart Apache and then remove (rename) .htaccess file.
    Oleg Ignatiuk / Crawlability Inc.
    vBSEO 3.6.0 GOLD Released!
    Unveiling the NEW vBSEO Sitemap Generator 3.0. - available NOW for vBSEO Customers!


  3. #3
    Junior Member
    Real Name
    Toni
    Join Date
    Dec 2007
    Location
    Spain
    Posts
    23
    Liked
    0 times
    Quote Originally Posted by Oleg Ignatiuk View Post
    Hello,

    you should insert rewrite rules from .htaccess into <Directory> section without changes, then restart Apache and then remove (rename) .htaccess file.
    I have proven with this, but some pages show eror "page not found"

    how I can fix the problem?

    Thanks!

  4. #4
    vBSEO Staff Oleg Ignatiuk's Avatar
    Real Name
    Oleg Ignatiuk
    Join Date
    Jun 2005
    Location
    Belarus
    Posts
    25,689
    Liked
    157 times
    What is an example URL?
    Oleg Ignatiuk / Crawlability Inc.
    vBSEO 3.6.0 GOLD Released!
    Unveiling the NEW vBSEO Sitemap Generator 3.0. - available NOW for vBSEO Customers!


  5. #5
    Junior Member
    Real Name
    Toni
    Join Date
    Dec 2007
    Location
    Spain
    Posts
    23
    Liked
    0 times
    have reverted the changes in the httpconf,
    because I don't want to bother the forum users.
    Guitarristas.Info - Foros, Descargas, MP3, Lecciones, Ejercicios, Videos, etc...

    To my I like a lot the vbseo, but the load in excess the server apache .
    I need to solve that problem.

    Now I have 1GB of ram,
    you believe that if contract more ram the server will go better.

    Thanks!
    Toni.

  6. #6
    vBSEO Staff Oleg Ignatiuk's Avatar
    Real Name
    Oleg Ignatiuk
    Join Date
    Jun 2005
    Location
    Belarus
    Posts
    25,689
    Liked
    157 times
    Please check this post for some vBSEO performance suggestions: Optimization Tweaks?
    Oleg Ignatiuk / Crawlability Inc.
    vBSEO 3.6.0 GOLD Released!
    Unveiling the NEW vBSEO Sitemap Generator 3.0. - available NOW for vBSEO Customers!


  7. #7
    Junior Member
    Real Name
    Toni
    Join Date
    Dec 2007
    Location
    Spain
    Posts
    23
    Liked
    0 times
    Thanks, but I already read that message. . .
    the most important optimization is to put the one htaccess in the http.conf,
    but this option not work for my.

    my question again:
    you believe that if contract more ram the server will go better?

    Thanks!

  8. #8
    Senior Member
    Real Name
    A.D
    Join Date
    Oct 2007
    Location
    France
    Posts
    159
    Liked
    0 times
    When I was using apache I had my rewrites like that

    Code:
    <Directory "/var/www/website.com/forums">
    AllowOverride None
    RewriteEngine On
    # Some servers require the Rewritebase directive to be
    # enabled (remove '#' at the beginning to activate)
    # Please note: when enabled, you must include the path
    # to your root vB folder (i.e. RewriteBase /forums/)
    RewriteBase /forums
    #RewriteCond %{HTTP_HOST} !^www\.yourdomain\.com
    #RewriteRule (.*) http://www.yourdomain.com/forums/$1 [L,R=301]
    RewriteRule ^((urllist|sitemap_).*\.(xml|txt)(\.gz)?)$ vbseo_sitemap/vbseo_getsitemap.php?sitemap=$1 [L]
    RewriteCond %{QUERY_STRING} !vbseourl=
    RewriteCond %{REQUEST_URI} !(admincp/|modcp/|chat|cron)
    RewriteRule ^(.*\.php(/.*)?)$ vbseo.php?vbseourl=$1 [L,QSA]
    RewriteCond %{REQUEST_FILENAME} !\.(jpg|gif)$
    RewriteRule ^(archive/.*)$ vbseo.php?vbseourl=$1 [L,QSA]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !^(admincp|modcp|clientscript|cpstyles|images)/
    RewriteRule ^(.+)$ vbseo.php?vbseourl=$1 [L,QSA]
    </Directory>
    As you can see I haven't touched anything in the rewrites, just make sure to enclose it in the forum root dir not the www root dir, and put the rules at the bottom of the httpd.conf to be sure all dependencies are loaded before and no you havent performance bug, looks like a bad configuration only.

  9. #9
    Junior Member
    Real Name
    Toni
    Join Date
    Dec 2007
    Location
    Spain
    Posts
    23
    Liked
    0 times
    Ok, thanks class101.
    you have more webs in your server?

    I tested it, but I have more forums in my server.
    I need to add this intro a virtualhost tags.
    #<VirtualHost *:80>
    # ServerAdmin webmaster@dummy-host.example.com
    # DocumentRoot /www/docs/dummy-host.example.com
    # ServerName dummy-host.example.com
    # ErrorLog logs/dummy-host.example.com-error_log
    # CustomLog logs/dummy-host.example.com-access_log common
    #</VirtualHost>

    and that cause some problems,
    for that reason I opted to modify the httpcong.include
    /var/www/vhosts/myweb.com/conf/httpconf.include
    (same as http.conf but for a single domain).
    Then I get the error "page not found" in some pages of the forum (thread, read post, etc..).

    Sorry my English...

  10. #10
    vBSEO Staff Oleg Ignatiuk's Avatar
    Real Name
    Oleg Ignatiuk
    Join Date
    Jun 2005
    Location
    Belarus
    Posts
    25,689
    Liked
    157 times
    Now I have 1GB of ram,
    you believe that if contract more ram the server will go better.
    In most cases adding RAM improves performance, the impact differs though.
    Oleg Ignatiuk / Crawlability Inc.
    vBSEO 3.6.0 GOLD Released!
    Unveiling the NEW vBSEO Sitemap Generator 3.0. - available NOW for vBSEO Customers!


  11. #11
    Senior Member
    Real Name
    A.D
    Join Date
    Oct 2007
    Location
    France
    Posts
    159
    Liked
    0 times
    Quote Originally Posted by ToniLloret View Post
    Ok, thanks class101.
    you have more webs in your server?

    I tested it, but I have more forums in my server.
    I need to add this intro a virtualhost tags.
    #<VirtualHost *:80>
    # ServerAdmin webmaster@dummy-host.example.com
    # DocumentRoot /www/docs/dummy-host.example.com
    # ServerName dummy-host.example.com
    # ErrorLog logs/dummy-host.example.com-error_log
    # CustomLog logs/dummy-host.example.com-access_log common
    #</VirtualHost>

    and that cause some problems,
    for that reason I opted to modify the httpcong.include
    /var/www/vhosts/myweb.com/conf/httpconf.include
    (same as http.conf but for a single domain).
    Then I get the error "page not found" in some pages of the forum (thread, read post, etc..).
    Sorry my English...
    Why that cause problems ? Did you tried something like

    Code:
    <VirtualHost *:80>
    DocumentRoot /www/docs/dummy-host.example.com
    
    <Directory "/www/docs/dummy-host.example.com/forums">
    AllowOverride None
    RewriteEngine On
    # Some servers require the Rewritebase directive to be
    # enabled (remove '#' at the beginning to activate)
    # Please note: when enabled, you must include the path
    # to your root vBulletin folder (i.e. RewriteBase /forums/)
    RewriteBase /forums
    #RewriteCond %{HTTP_HOST} !^www.yourdomain.com
    #RewriteRule (.*) http://www.yourdomain.com/forums/$1 [L,R=301]
    RewriteRule ^((urllist|sitemap_).*.(xml|txt)(.gz)?)$ vbseo_sitemap/vbseo_getsitemap.php?sitemap=$1 [L]
    RewriteCond %{QUERY_STRING} !vbseourl=
    RewriteCond %{REQUEST_URI} !(admincp/|modcp/|chat|cron)
    RewriteRule ^(.*.php(/.*)?)$ vbseo.php?vbseourl=$1 [L,QSA]
    RewriteCond %{REQUEST_FILENAME} !.(jpg|gif)$
    RewriteRule ^(archive/.*)$ vbseo.php?vbseourl=$1 [L,QSA]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !^(admincp|modcp|clientscript|cpstyles|images)/
    RewriteRule ^(.+)$ vbseo.php?vbseourl=$1 [L,QSA]
    </Directory>
    </VirtualHost>
    must work I have also vhost server generally one for my website and the other one for phpmyadmin, should work fine , look in error_log so to check if there is any other thing that could help to identify what are you doing wrong but if your problem is only about 404 I think its not needed to RAM upgrade because this wont magically solve the prob, I bet you have a simple rewrite problem, maybe another rewrite not from vbseo can conflict theses so

  12. #12
    Junior Member
    Real Name
    Toni
    Join Date
    Dec 2007
    Location
    Spain
    Posts
    23
    Liked
    0 times
    Thanks for reply

    In most cases adding RAM improves performance, the impact differs though.
    I hope the ram can help.
    Tomorrow I will have 2GB of Ram (1Gb more than now)
    I will tell him if it improved with more ram

    Why that cause problems ? Did you tried something like
    Yes, i tested it, but not work for my....
    Code:
    <VirtualHost ********:443>
    	ServerName   mysite.com:443
    	ServerAlias  mysite.com
    	UseCanonicalName Off
    	SuexecUserGroup         guitarristas psacln
    	ServerAdmin  xxxxx@mysite.com
    	DocumentRoot /var/www/vhosts/mysite.com/httpsdocs
    	CustomLog  /var/www/vhosts/mysite.com/statistics/logs/access_ssl_log plesklog
    	ErrorLog     /var/www/vhosts/mysite.com/statistics/logs/error_ssl_log
    
    
    
    	<Directory /var/www/vhosts/mysite.com/httpdocs/foro>
    
          RewriteEngine On
    
    RewriteRule ^((urllist|sitemap_).*\.(xml|txt)(\.gz)?)$ vbseo_sitemap/vbseo_getsitemap.php?sitemap=$1 [L]
    
    RewriteCond %{QUERY_STRING} !vbseourl=
    RewriteCond %{REQUEST_URI} !(admincp/|modcp/|chat|cron)
    RewriteRule ^(.*\.php(/.*)?)$ vbseo.php?vbseourl=$1 [L,QSA]
    
    RewriteCond %{REQUEST_FILENAME} !\.(jpg|gif)$
    RewriteRule ^(archive/.*)$ vbseo.php?vbseourl=$1 [L,QSA]
    
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !^(admincp|modcp|clientscript|cpstyles|images)/
    RewriteRule ^(.+)$ vbseo.php?vbseourl=$1 [L,QSA]
    
    RewriteEngine On
    RewriteRule ^((urllist|sitemap).*\.(xml|txt)(\.gz)?)$ vbseo_sitemap/vbseo_getsitemap.php?sitemap=$1 [L]
    	</Directory>
    
    </VirtualHost>
    if your problem is only about 404 I think its not needed to RAM upgrade because this wont magically solve the prob
    Sure hehe...

    My main problem is that since I installed the vbseo the servant it is loaded too much. Then it fails and it no longer connects with the database until I restart the server.

  13. #13
    Senior Member
    Real Name
    A.D
    Join Date
    Oct 2007
    Location
    France
    Posts
    159
    Liked
    0 times
    Quote Originally Posted by ToniLloret View Post
    My main problem is that since I installed the vbseo the servant it is loaded too much. Then it fails and it no longer connects with the database until I restart the server.
    ha ok , either from what you copied I see one bad thing, your docroot to

    DocumentRoot /var/www/vhosts/mysite.com/httpsdocs

    <Directory /var/www/vhosts/mysite.com/httpdocs/foro>

    httpsdocs != httpdocs

    not sure you made the error just by showing me a sample but make sure the directory rules is correctly inside the docroot else it will be never findable

  14. #14
    Junior Member
    Real Name
    Toni
    Join Date
    Dec 2007
    Location
    Spain
    Posts
    23
    Liked
    0 times
    Thanks class101

    I believe that it is very probable that that it was the cause for which I threw my server to the floor during several hours yesterday xD

    I will attempt it again in another occasion, first I will check like everything goes with 1Gb more than ram (I have curiosity)

    you believe that this code should work?
    Code:
    <VirtualHost ********:443>
    	ServerName   mysite.com:443
    	ServerAlias  mysite.com
    	UseCanonicalName Off
    	SuexecUserGroup         guitarristas psacln
    	ServerAdmin  xxxxx@mysite.com
    	DocumentRoot /var/www/vhosts/mysite.com/httpsdocs
    	CustomLog  /var/www/vhosts/mysite.com/statistics/logs/access_ssl_log plesklog
    	ErrorLog     /var/www/vhosts/mysite.com/statistics/logs/error_ssl_log
    
    
    
    	<Directory /var/www/vhosts/mysite.com/httpdocs/foro>
    
          RewriteEngine On
    
    RewriteRule ^((urllist|sitemap_).*\.(xml|txt)(\.gz)?)$ vbseo_sitemap/vbseo_getsitemap.php?sitemap=$1 [L]
    
    RewriteCond %{QUERY_STRING} !vbseourl=
    RewriteCond %{REQUEST_URI} !(admincp/|modcp/|chat|cron)
    RewriteRule ^(.*\.php(/.*)?)$ vbseo.php?vbseourl=$1 [L,QSA]
    
    RewriteCond %{REQUEST_FILENAME} !\.(jpg|gif)$
    RewriteRule ^(archive/.*)$ vbseo.php?vbseourl=$1 [L,QSA]
    
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !^(admincp|modcp|clientscript|cpstyles|images)/
    RewriteRule ^(.+)$ vbseo.php?vbseourl=$1 [L,QSA]
    
    RewriteEngine On
    RewriteRule ^((urllist|sitemap).*\.(xml|txt)(\.gz)?)$ vbseo_sitemap/vbseo_getsitemap.php?sitemap=$1 [L]
    	</Directory>
    
    </VirtualHost>
    somebody here is working with a similar code in the htttp.conf?

    I have doubts of if this
    <Directory /var/www/vhosts/mysite.com/httpdocs/foro>
    goes inside the tags
    </VirtualHost>

    Regards!

  15. #15
    Senior Member briansol's Avatar
    Real Name
    Brian
    Join Date
    Apr 2006
    Location
    Central CT, USA
    Posts
    6,981
    Liked
    8 times
    are you sure you're in the right place?

    :443 = SSL

    don't you want to be on :80 ?

Page 1 of 2 1 2 LastLast

Similar Threads

  1. Hotlink Protection Tutorial (Apache Server - .htaccess files)
    By NeutralizeR in forum Member Articles
    Replies: 15
    Last Post: 06-08-2011, 03:25 PM
  2. move rewrite rules from .htaccess to httpd.conf
    By webgroup in forum Troubleshooting
    Replies: 11
    Last Post: 10-08-2008, 06:25 PM
  3. Moving info from .htaccess to httpd.conf
    By Tigermoth in forum Troubleshooting
    Replies: 11
    Last Post: 01-01-2007, 08:24 AM
  4. Replies: 1
    Last Post: 03-20-2006, 03:50 PM
  5. Replies: 2
    Last Post: 02-24-2006, 11:11 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •