1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

FAQ: mod_rewrite, 301 redirects, and optimizing Apache.

Discussion in 'Apache' started by Nintendo, Jul 30, 2005.

  1. Steupz

    Steupz Peon

    Messages:
    917
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #801
    Is there a basic wordpress htaccess?
    Just something to help speed up the site and maybe have better adsense targeting.
     
    Steupz, Apr 17, 2008 IP
  2. boula

    boula Peon

    Messages:
    25
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #802
    nice nice thanks
     
    boula, May 17, 2008 IP
  3. Toldo

    Toldo Active Member

    Messages:
    292
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    58
    #803
    do you guys recommend redirecting domain.com/index.htm to domain.com/
     
    Toldo, May 19, 2008 IP
  4. parkedrevenue

    parkedrevenue Member

    Messages:
    24
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    38
    #804
    Insteadof placing seperate htaccess file. Try to insert mod rewirete rules httpd.conf file in the server. As high loads some times apache makes unstability especially at recent multi core processors.
     
    parkedrevenue, May 22, 2008 IP
  5. gokten

    gokten Guest

    Best Answers:
    0
    #805
    yhank you very good ;)
     
    gokten, Jun 10, 2008 IP
  6. TommyD

    TommyD Peon

    Messages:
    1,397
    Likes Received:
    76
    Best Answers:
    0
    Trophy Points:
    0
    #806
    I found something and trying to get a work around. I can only pass 9 parameters, and I need more.

    Example:

    ^something_here/(.*)/(.*)/(.*)/(.*)/(.*)/(.*)/(.*)/(.*)/(.*)/(.*)/(.*)/(.*)/(.*)/$
    /go_here_instead/index.php?1=$1&2=$2&3=$3&4=$4&5=$5&6=$6&7=$7&8=$8&9=$9&10=$10&11=$11&12=$12&13=$13 [L]

    Any help?

    tom
     
    TommyD, Jun 18, 2008 IP
  7. koolman

    koolman Peon

    Messages:
    76
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #807
    nice post, thanks, I have been looking around for this thing
     
    koolman, Jun 20, 2008 IP
  8. Tim Smith

    Tim Smith Peon

    Messages:
    23
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #808
    Dear all,
    Thank you for nice articles.

    I would like to ask you, what is the difference between 2 ways:

    RewriteRule ^musics/search/artistID-(.*)\.html$ ?mode=musics&action=search&artistID=$1 [L]

    and

    RewriteRule ^musics-search-artistID-(.*)\.html$ ?mode=musics&action=search&artistID=$1 [L]


    I am using the second one, because with the first one I have to change path level(s) of included files and images inside the file.

    Thank you.

    Tim
     
    Tim Smith, Jun 23, 2008 IP
  9. allen.ferrer

    allen.ferrer Banned

    Messages:
    29
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #809
    I have been looking everywhere about this one.. but no luck for me.. great I found yours! whew!
     
    allen.ferrer, Jun 24, 2008 IP
  10. yantomulia

    yantomulia Peon

    Messages:
    57
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #810
    really helpful, finally found faq about rewrite :)
     
    yantomulia, Jun 28, 2008 IP
  11. XT Gohan

    XT Gohan Greenhorn

    Messages:
    29
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    11
    #811
    I found this thread extremely helpful and I think it makes a great deal of sense. However, I edited my .htacess files but the urls aren't changing? Also, I was unable to find the httpd.conf file. I do have Apache on my server, it's this version: Apache version - 2.2.8 (Unix). I'm not really sure as to the reason why, but here's my .htaccess file.
    What my basic intention is to change my links from:
    domain.com/index.php?p=recent_news to something like domain.com/index/p/recent/news.

    Any ideas on what my problem really is?
     
    XT Gohan, Jul 5, 2008 IP
  12. nastynappy

    nastynappy Banned

    Messages:
    499
    Likes Received:
    16
    Best Answers:
    0
    Trophy Points:
    0
    #812
    hello, I am facing a problem here..
    my htacess file :
    # Rewrite URLs
    <ifmodule mod_rewrite.c>

    RewriteEngine on

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(search)\/(.*)$ index.php?act=$1&keyword=$2 [L,QSA]
    </ifmodule>

    it works fine when I use "http://localhost/search/" or "http://localhost/search/john", but not when i use "http://localhost/search", notice the tailing slash gone, it gives a 404 error.
    Please help me ! I really need help!

    Thanks
     
    nastynappy, Jul 10, 2008 IP
  13. shnippy

    shnippy Peon

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #813
    I am so thankful to have found this thread. After weeks of searching the net, and coming up empty this has been a real blessing.

    I have ben reading a lot about mod_rewrite and perl using a db, but that unfortunately does not apply to my situation.

    I am working on a dynamic site powered by perl, and it uses a flatfile system (no database). It is a public site with thousands of pages. Users creat pages themselves everyday, so new urls are always changing, being added or updated.

    Right now the urls are ugly, and I know it is hurting the websites SE results as only a small fraciton of the pages are being indexed.

    Is there a way to create clean urls for dynamic pages that are constantly being added?

    here is an example url:

    ht*p://www.domain.com/cgi-bin/business/business.pl??category=nintendo11&item=1217906501

    where nintendo11 is a directory and 1217906501 is the items flatfile name

    There is no way to keep up trying to change all of these by hand, each time a new one is added to the site.

    I would sure like to get a better looking url, somehow, that would "automatically (probably dreaming here)" change:

    (please excuse the * It wont let me post a url as Im a new member)
    This:
    ht*p://www.domain.com/cgi-bin/business/business.pl??category=nintendo11&item=1217906501

    To:
    ht*p://www.domain.com/business/nintendo/1217906501

    Or even this:
    ht*p://www.domain.com/business/nintendo/1217906501.html

    Can anyone please offer some advice and assistance?

    Many Thanks,

    Shnippy
     
    shnippy, Jul 29, 2008 IP
  14. Fortumania

    Fortumania Active Member

    Messages:
    321
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    58
    #814
    Dear Nintendo and visitors

    How do I make redirect 301 for .aspx pages ???

    I would like to redirect few URLs (homepage) to the main URL.

    My homepage is "http://www.________.com/" and I would like to redirect
    (301) the following pages:

    "http://www.________.com"
    "http://________.com"
    "http://________.com/"
    "www.________.com"
    "www.________.com/"
    "www.________.com/default.aspx"

    Right now the default URL in my CMS is "www.________.com/default.aspx",
    but the homepage is "http://www.________.com/"


    By the way, Google webmaster tool thinks that I have 2 pages with
    duplicate Meta tags - the "/" page and the "/default.aspx" page.


    Thanks
    Fortumania
     
    Fortumania, Aug 3, 2008 IP
  15. scylla

    scylla Notable Member

    Messages:
    1,025
    Likes Received:
    33
    Best Answers:
    1
    Trophy Points:
    225
    #815
    OK, I need some code that does this...

    I run a hosting company and as such many subdomains are being made, I need this to happen.

    inside of every .htaccess file on each subdomain OR some kindof coding that will have the same effect across all of the subdomains... Every time they run into a 404 error page, I want them redirected to the main site, http://vgchat.info
     
    scylla, Aug 29, 2008 IP
  16. rob_v

    rob_v Peon

    Messages:
    72
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #816
    Is there a way to make a generic mod_rewrite?
    I using a custom MVC framework that I wrote. Im looking to do someting similar to what Zend does
    right now my urls are basically this :

    www.site.com/dispatcher/?action=XXX&var1=AAA&var2=BBB&var3=CCC

    where there is an index.php file in each /dispatcher/ directory
    there is always an action and
    var1 , var2,var3 could by anything and could go up the 9 vars long
    ie www.site.com/product/?action=dispaly&id=1


    Im looking to be able to write my URLs like this :

    www.site.com/dispatcher/XXX/var1/AAA/var2/BBB/var3/CCC

    Where XXX is the action and var1/AAA are key/value parts

    Is this possible w/ mod_rewrite?

    Ive look here :
    http://www.datakoncepts.com/seo
    under the Unlimited key/value pairs section - but I just cant get it to go - keep getting 500 errors.

    Any help at all would be great.
    Thanks
    -Rob
     
    rob_v, Aug 29, 2008 IP
  17. XT Gohan

    XT Gohan Greenhorn

    Messages:
    29
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    11
    #817
    Apparently, the person is probably on break/vacation so you can use this thread for reference and teach it yourself. If you guys wanted it to be handed to you for free then I suggest you guys go here: Mod-Rewrite and post in the beginners sections or questions about specific URLs. This stuff isn't rocket science, even I thought I couldn't master it but I'm understanding it more or less.
     
    XT Gohan, Aug 30, 2008 IP
  18. im.imrankhan

    im.imrankhan Active Member

    Messages:
    164
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    53
    #818
    Hi
    I am in a problem. I have a site Customermath.com. I have created a new subdomain on comlaint.customermath.com Here any one can come and post there complaint. I am also providing other service on customermath.com which need person to login. I want to maintain session between subdomain like if some one log in through customermath.com then he should not be asked to log in on complaint.customermath.com and vis-versa. Please help me if any one can.
     
    im.imrankhan, Sep 1, 2008 IP
  19. vishwaa

    vishwaa Well-Known Member

    Messages:
    271
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    138
    #819
    This is not a mod rewrite problem.

    If you have programming knowledge, please refer http://in.php.net/setcookie. The parameters 4 & 5 can fulfill your requirements.
     
    vishwaa, Sep 1, 2008 IP
  20. TommyD

    TommyD Peon

    Messages:
    1,397
    Likes Received:
    76
    Best Answers:
    0
    Trophy Points:
    0
    #820
    If you find it, can you post it here? Doesn't seems like as the pages grow, more advanced material is being added.

    Thx,

    Tom
     
    TommyD, Sep 4, 2008 IP