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.

wordpress problem - only front page works, inner links dont (mod rewrite problem?)

Discussion in 'PHP' started by Lorelei, Apr 17, 2009.

  1. #1
    I hope someone will be able to help me out a little, because I am stuck for 2 days now.

    I was moving my blog over to new host from another server. the database was full of bugs thanks to all the wonderful plug ins I used, so I had a hell of a time trying to restore the database. Finally, after a lot of tweaking, I managed to import it without errors. but, I am only able to view the front page, but any link I click, is broken. My guess was that it has something to do with rewrite rules for wordpress, so I manually added .htaccess file with:

    PHP Code:
    # BEGIN wordpress

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase
    /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond
    %{REQUEST_FILENAME} !-d
    RewriteRule
    . /index.php [L]
    </
    IfModule>

    # END wordpress

    But it did not help.

    The blog I am moving is originally pointing to toptut.com (I changed the DNS back to old server for now, to avoid downtime, while I am experimenting.).
    On the Servint server, I installed and restored the database to http://loreleiweb.com/25 (and yes I changed to home directory in phpmyadmin for loreleiweb.com/25, just to make it work)

    The structure remained the same, for example,
    http://loreleiweb.com/25/2009/04/10/ramiro-coffee-neat-and-light-weight-magazine-theme/
    and
    http://www.toptut.com/2009/04/10/ramiro-coffee-neat-and-light-weight-magazine-theme/

    Only that loreleiweb.com/25's inner pages redirect to loreleiweb.com's front page.

    HOW do I make the permalinks work? I'd be grateful if anyone can help me please.
    I already tried adding loreleiweb.com/25 to rewrite base and rewriterule, no luck.

    Thanks,
    Liza
     
    Lorelei, Apr 17, 2009 IP
    Boulder likes this.
  2. Boulder

    Boulder Well-Known Member

    Messages:
    806
    Likes Received:
    46
    Best Answers:
    0
    Trophy Points:
    118
    #2
    There are two places in the database and in phpmyadmin to change the home setting! Did you find and change both of those or in just the one place?

    The second setting location is not as easy to find as the main one, have to page the options table with button like this [>] at bottom to go to other entries.



    Boulder
     
    Boulder, Apr 17, 2009 IP
  3. Lorelei

    Lorelei Notable Member

    Messages:
    1,789
    Likes Received:
    166
    Best Answers:
    0
    Trophy Points:
    205
    #3
    Hi Boulder, thanks for your reply. Yes I changed it in both places, but that only brings the front page to work :(
     
    Lorelei, Apr 18, 2009 IP
  4. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,623
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #4
    Something is wrong, that's for sure. Did links and such function as intended before you imported the database? (I'm thinking here of the original installation of WP, with the sample "hello world" post and such.) I tried accessing your posts with the direct links (/?p=<number>) but it still just redirects to the front page.
     
    PoPSiCLe, Apr 18, 2009 IP
    Lorelei likes this.
  5. Boulder

    Boulder Well-Known Member

    Messages:
    806
    Likes Received:
    46
    Best Answers:
    0
    Trophy Points:
    118
    #5
    Did you go into the permalinks settings and refresh (Update) the permalinks?


    Boulder
     
    Boulder, Apr 18, 2009 IP
    Lorelei likes this.
  6. Bohra

    Bohra Prominent Member

    Messages:
    12,573
    Likes Received:
    537
    Best Answers:
    0
    Trophy Points:
    310
    #6
    First give .htaccess 777 chmod permission and then retry to save ur permananent links settings
     
    Bohra, Apr 18, 2009 IP
    Lorelei likes this.
  7. Lorelei

    Lorelei Notable Member

    Messages:
    1,789
    Likes Received:
    166
    Best Answers:
    0
    Trophy Points:
    205
    #7
    Thanks for all your replies guys!

    @ Bohra, .htaccess is on 777, and I tried to update but it did not help.

    @Boulder, I did but in any way it was one of the settings restored with the old database. I tried saving it once more like that, but still nada.

    @PoPSiCLe you can see the site now on toptut.com, it works fine, all links are functioning. Wordpress installation I believe is fine, the database itself kept generating an error upon importing, so it took a massive effort (and a few re installations) to get it to at least get imported with all the posts properly.

    I had a similar problem once with some other blog and I was told that rewrite rules for wordpress were missing, but in this case I do have them in htaccess file, right?
     
    Lorelei, Apr 18, 2009 IP
  8. Boulder

    Boulder Well-Known Member

    Messages:
    806
    Likes Received:
    46
    Best Answers:
    0
    Trophy Points:
    118
    #8
    Turn off completely the permalinks and set it back to default setting than Save!

    Than go back to front of blog and see if links work right then?

    If they do? Than you will know that the problem is with the .htaccess file rules?

    If the links still do not work, after switching to default, than the problem is probably not with the .htaccess but would be some other config setting issue someplace else.



    Boulder
     
    Boulder, Apr 18, 2009 IP
  9. Lorelei

    Lorelei Notable Member

    Messages:
    1,789
    Likes Received:
    166
    Best Answers:
    0
    Trophy Points:
    205
    #9
    WOW! it works!!!:D

    http://loreleiweb.com/25/?p=1870 <--- yay, that one didn't work previously!

    okay so this means problem is with .htaccess, but where?
    this is my entire .htaccess file:

    # BEGIN wordpress
    
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    
    # END wordpress
    # BEGIN WordPress
    
    # END WordPress
    
    
    
    Code (markup):
    that second past at the end:
    # BEGIN WordPress

    # END WordPress

    I think appeared only recently, it was not there before. CMOD is set to 777 for this file, and I think 755 for the entire blog.
     
    Lorelei, Apr 18, 2009 IP
  10. Bohra

    Bohra Prominent Member

    Messages:
    12,573
    Likes Received:
    537
    Best Answers:
    0
    Trophy Points:
    310
    #10
    Is mod rewrite enabled on ur server ?
     
    Bohra, Apr 18, 2009 IP
  11. Lorelei

    Lorelei Notable Member

    Messages:
    1,789
    Likes Received:
    166
    Best Answers:
    0
    Trophy Points:
    205
    #11
    Hmm, good question, how do I check it? (i am on dedicated, so there probably is no problem to check)
     
    Lorelei, Apr 18, 2009 IP
  12. Boulder

    Boulder Well-Known Member

    Messages:
    806
    Likes Received:
    46
    Best Answers:
    0
    Trophy Points:
    118
    #12
    Place this rules in the .htaccess file in the 25 directory and try it.


    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /25/
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /25/index.php [L]
    </IfModule>

    # END WordPress




    Let me know if this works? Make sure to turn back on the permalinks and set this in the field = /%postname%/


    Boulder
     
    Boulder, Apr 18, 2009 IP
  13. Lorelei

    Lorelei Notable Member

    Messages:
    1,789
    Likes Received:
    166
    Best Answers:
    0
    Trophy Points:
    205
    #13
    yep, that worked perfect! I switched the permalinks back to old version, and it worked!! thank you so much!!!

    Now, I would want to change the toptut.com domain to point into the /25/ folder. So once I change the DNS, I:
    change both locations in phpmyadmin to toptut
    do i also need to changed the htaccess file in any way?
     
    Lorelei, Apr 18, 2009 IP
  14. Boulder

    Boulder Well-Known Member

    Messages:
    806
    Likes Received:
    46
    Best Answers:
    0
    Trophy Points:
    118
    #14
    Kool glad it worked... LOL


    Okay NO! you will not need to change anything in the .htaccess file when you change the main part to toptut.com.

    You would only need to change the rules if you were to change the "25" sub folder name!


    Also you should change the permissions back to 644 or 666 on the .htaccess file. There is not a reason what so ever to have that file set at 777 and it would be a security risk to leave it set that way.. All my .htaccess files are at 644.


    Boulder
     
    Boulder, Apr 18, 2009 IP
  15. olddocks

    olddocks Notable Member

    Messages:
    3,275
    Likes Received:
    165
    Best Answers:
    0
    Trophy Points:
    215
    #15
    Just run test.php with this code inside

    Once it loads, look carefully for mod_rewrite under apache modules. If it is listed then mod_rewrite is installed.
     
    olddocks, Apr 18, 2009 IP
  16. Bohra

    Bohra Prominent Member

    Messages:
    12,573
    Likes Received:
    537
    Best Answers:
    0
    Trophy Points:
    310
    #16
    Instead since u are on a dedicated server do this

    Find and Open your httpd.conf

    Find

    LoadModule rewrite_module modules/mod_rewrite.so

    and see whether it has # before it if it does remove #

    Restart Apache Server
     
    Bohra, Apr 18, 2009 IP
  17. Lorelei

    Lorelei Notable Member

    Messages:
    1,789
    Likes Received:
    166
    Best Answers:
    0
    Trophy Points:
    205
    #17
    Boulder, thank you so much, you are a real angel! :)

    I changed the htaccess to 644 and won't touch it anymore. So I will just change 'siteurl' and 'home' values at phpmyadmin and I am set. yay, it took a bloody week to move this webiste and all thanks to one plug in that totally overwrote stuff in my database!

    Thanks Bohra and olddocks for your kind help too!!
     
    Lorelei, Apr 18, 2009 IP