• Resolved greenercreative24

    (@greenercreative24)


    Right, let me tell you all the facts then hopefully somebody could help me out. It would be much appreciated.

    WordPress Version: 3.1.2
    Server: 123 Reg UK using the WordPress installed app.

    Problem: I’m trying to create “pretty” permalinks. I know how to go about it to some degree. I.e. Settings > Permalinks > Custom Structure > %examplehere%. In this case I want to use %postname%.

    So I hit Save changes, to be greeted with this:
    If your .htaccess file were writable, we could do this automatically, but it isn’t so these are the mod_rewrite rules you should have in your .htaccess file. Click in the field and press CTRL + a to select all.

    So I go to my .htaccess file via FTP and try to edit this to include the text, but the suggested text is already there.
    Firstly this file sits outside the wordpress folder (Is this the default place WordPress saves it?). When I place the .htaccess file inside the wordpress folder that contains everything, my site breaks. What permissions do I need to give the .htaccess file in order for it to be writable? I’ve worked through them all and still no joy.

    The one thing at the top of my .htaccess file is this:
    RedirectMatch permanent ^/$ https://www.mysite.com/index Should this even be in there?

    I’m aware that this is a recurring problem. Please help.
    Thanks,
    gc24

Viewing 9 replies - 1 through 9 (of 9 total)
  • Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    Other than the fact that you really shouldn’t use %postname% as your permalink …

    If your WP install is in /wordpress, then your .htaccess needs to be in that folder too. You can (safely) ignore and leave alone the other one.

    You make a SECOND one in /wordpress/.htaccess with the content from WP.

    Thread Starter greenercreative24

    (@greenercreative24)

    Ok many thanks, so include a .htaccess file in the /wordpress folder: Check. Then make a second what? A .htaccess file? Where? With the content from WP? Apologies…

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    You said you have an .htaccess file one folder UP from the /wordpress folder.

    That’s .htaccess file #1

    The one IN the /wordpress folder is .htaccess #2 ??

    I’m having the very same problem and editing the .htaccess file is not working at all. WordPress did not create one automatically. My WordPress files are in /blog but the index.php is in the root directory. This is noted in the blog URI settings.

    Here’s what I did so far:

    1) uploaded a new .htaccess file (saved as plain text, uploaded and changed the name on the server) to /blog. I also tried editing this directly via cPanel File Manager – not working.

    2) set the permissions to 644 (also tried 666 & 755)

    3) Tried two versions of the requested content to the .htaccess based on info I found while Googling:

    Version 1 (as requested by WordPress)

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

    Version 2 (found via Google)

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

    Neither of these is working. My page links and post links are all broken. I’ve never had this trouble with WordPress before. What am I doing wrong?

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    This is noted in the blog URI settings

    You mean you have WP in /blog, but running out of root (i.e. domain.com)?

    If so, use this in the root folder:

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

    If you have WP running from domain.com/blog then the .htaccess goes in the BLOG folder and should be

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

    Thread Starter greenercreative24

    (@greenercreative24)

    Thanks Ipstenu, you’ve been very helpful. Still however having no luck at all with this. Sorry to be a pain in the ass.

    Few more details:

    The directory on my server is titled: index
    This is what I called my WordPress folder when I installed the app on my server (123 Reg)

    Under general settings:
    WordPress address (URL): https://www.examplesite.com:/index
    Site address (URL): https://www.examplesite.com

    My .htaccess file looks like this:

    RedirectMatch permanent ^/$ https://www.examplesite.com/index
    
    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    # END WordPress

    So I have 3 files on my server for this domain: https://www.examplesite.com

    1. My .htaccess file.
    2. Folder titled index with all the wp files within.
    3. A random html file that reads:
    Welcome to your new 123-reg website! If you’ve uploaded your site but are still getting this welcome page try doing a SHIFT+Reload or a CTL+F5 – this will clear the cache. Good luck with your new website! You can delete this page or change its content.

    I tried placing a second .htaccess file in the wordpress folder (called index in my case). This didn’t work i’m afraid. I refreshed the files, clicked Save Changes, still the same message.

    Is there anybody out there who knows a way to get ‘pretty’ links? i.e.: https://www.examplesite.com/examplepage

    My whole site works great on Default permalinks. When i try to edit the Custom Structure it all goes wrong. I keep getting that damn message:
    If your .htaccess file were writable, we could do this automatically, but it isn’t so these are the mod_rewrite rules you should have in your .htaccess file. Click in the field and press CTRL + a to select all.
    All i want is to lose the ‘ugly’ ?p=123 extensions.

    What permissions do you need to give to the .htaccess file(s) and other folders on my server?

    All plug ins are disabled as well to try and get to the bottom of this.

    Any help with this would be greatly appreciated. I’m going out of my mind.

    Thanks,

    gc24

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    Delete the random HTML file for starters. ??

    What you’re doing is running WordPress in root out of it’s own directory. This is pretty common. We have a whole doc about it. https://codex.www.ads-software.com/Giving_WordPress_Its_Own_Directory

    You have this:
    /.htaccess
    /index/(with the WP fles)

    That’s GOOD! ?? We can work with this.

    The .htaccess should be

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

    Remove that top line with the redirect. You don’t need it. You DO need to COPY the index.php file from /index and put it in the same folder as the .htaccess, and then change the following and save the file.

    Change the line that says:
    require('./wp-blog-header.php');
    to the following, using your directory name for the WordPress core files:
    require('./index/wp-blog-header.php');

    @ipstenu,

    Thank you! Thank you! Thank you so much!
    It’s finally working! Hooray!

    Katchal

    Thread Starter greenercreative24

    (@greenercreative24)

    Ipstenu, I can’t thank you enough. Those last few pointers have done the trick. Thanks again for all your advice in the last post.

    gc24

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘The Permalinks and .htaccess File Problem’ is closed to new replies.