WordPress.org

Forums

Permalinks do not work in sub-site - please help (17 posts)

  1. garrityalf
    Member
    Posted 1 year ago #

    The company I work for has some sub-sites running on WordPress 3.4.1.

    I work with a Web Operations group and do not have access to any of the WP servers so I cannot see the files (that's company policy). We could upgrade to the latest version of WP but I do not think it's my role to go ahead and do this.

    They have a variety of sub-sites like:

    mysite.com/main
    mysite.com/alaska
    mysite.com/great-lakes

    Some of these sub-sites have a htaccess plugin that allows me to plug in redirect code. Other sub-sites do not have this plugin. All of the permalinks are turned off to default so they all use ugly URL. All of them currently work.

    The main thing they want me to do is turn on the permalinks to get all of the sub-sites to have pretty URLs. When I went into one of the sub-sites to turn on permalinks, I then viewed it live and I am getting 404 pages throughout. Also, when I logged into this site to publish a page, the "publisher" no longer works. What I mean is, I click PUBLISH. WP says it published, then when I go live, the page is 404.

    I then go back into the sub-site, turn off the permalink to ugly default, and it works again.

    For those sub-sites that have the htaccess plugin, I tried adding some redirect code:

    RewriteEngine On
    RewriteBase /alaska/
    RewriteRule ^index\.php$ - [L]
    
    # add a trailing slash to /wp-admin
    RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
    
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ - [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
    RewriteRule . index.php [L]

    This did not work. I also deleted the above and tried this:

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

    This did not help as well. Any advice or help is appreciated.

  2. Why on earth do you have RewriteBase /alaska/ in there at all?

    Where is WordPress installed? domain.com ? If so, your .hraccess is this:

    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    
    # add a trailing slash to /wp-admin
    RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
    
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ - [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
    RewriteRule . index.php [L]
  3. garrityalf
    Member
    Posted 1 year ago #

    Hi Mike - thanks so much for replying. The reason why I put that "alaska" in there is because I thought you had to put the sub-directory in the code. Guess not?

    I will definitely try your code tomorrow morning and report back. If you'd like to see the sites, they are here:

    http://www.regions.noaa.gov/main/

    It loads slowly so bear with it. If you want to see all of the sites, click on REGIONS and you can visit all of them. As I said above, they all currently work, just with ugly URLs. So I'm hoping your code will help me and I can turn on permalinks for all of them.

    Thanks, Mike W.

  4. Well... it depends WHERE WP is installed :) That's why I asked.

  5. garrityalf
    Member
    Posted 1 year ago #

    ok no problem. i will try your code in the morning and report back. thanks again for your assistance. sure hopes this fixes it :-)

  6. garrityalf
    Member
    Posted 1 year ago #

    Hi Mike,

    I copied and pasted the code into one of the regional WP sub-sites. I put it in the htaccess editor and saved it:

    http://designerandpublisher.com/images/wp01.jpg

    After I saved it, I then went into the Permalinks and changed it from default to Post name, then saved it:

    http://designerandpublisher.com/images/wp02.jpg

    After I did this, I opened up an existing page to see if the permalink was turned on like it should be. It was:

    http://designerandpublisher.com/images/wp03.jpg

    But when I looked at the page live, I got a 404 error:

    http://designerandpublisher.com/images/wp04.jpg

    I then went back into the publisher and published a new page. While I was creating the new page, the permalink automatically worked as you see below:

    http://designerandpublisher.com/images/wp05.jpg

    But when I published that page, it came back again as 404:

    http://designerandpublisher.com/images/wp06.jpg

    So I'm not sure what to do at this point. I copied the code below just to show you what I put into the htaccess editor. It would probably help if I could actually see the server and open the actual htaccess files to make sure the actual pasted code is there, rather than trust the htaccess editor plugin. Notice at the bottom of the code that htaccess editor is generating those # comments.

    Anyway, do you have any ideas?

    Thanks.

    =================

    CODE I PASTED INTO THE HTACCESS EDITOR:

    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]

    # add a trailing slash to /wp-admin
    RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]

    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ - [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
    RewriteRule . index.php [L]

    THIS WAS GENERATED AUTOMATICALLY BY THE HTACCESS EDITOR:

    # BEGIN WordPress

    # END WordPress

  7. These questions MUST be answered for me to help you:

    1) WHERE is WP actually installed on your server?

    /home/domain.com/

    /home/user/public_html/

    Something like that? I do need to know :)

    2) What is the name of the SITE we're working on? Is the site named alaska?

    3) Where are you putting your .htaccess? See the folders I asked you for in #1? Where in that structure?

    4) Are you running any caching plugins or services?

  8. garrityalf
    Member
    Posted 1 year ago #

    Hi - thanks again. I honestly don't know so I will ask the web operations people. When you say "where is WP...?" what exactly do you mean - so I know how to describe it to the web people?

    I also don't have access to the server, so that's also why I am going to ask the web people, so they can tell me where all of the files are.

  9. garrityalf
    Member
    Posted 1 year ago #

    As soon as I find out these answers will send to you. Thanks again, Mike.

  10. garrityalf
    Member
    Posted 1 year ago #

  11. garrityalf
    Member
    Posted 1 year ago #

    Hi Mike - my manager just told me that he prefers not to ask the web people to get the info you need. He's concerned about security. I apologize for this. The public sites are listed above.

    Is there any type of help or advice you can give me?

    Thanks.

  12. This is why I don't work for banks/governments. They don't quite understand security.

    I don't really know of a way to help you without that information.... So this advice probably sucks, but your manager is being paranoid and doesn't understand that this information isn't a security risk (or we'd never ask for it in public, we know better).

    You do too have server access. That's how you edit the .htaccess folder.

    The folder your .htaccess sits in AND it's content depends on how and where you installed WP. Normally people install it in something like /home/public_html/ and the URL it gets is http://example.com/ - the .htaccess lives in that public_html folder and has a RewriteBase /

    HOWEVER. Sometimes people will install WP like this: /home/public_html/wordpress/ and when they do that, WP will have TWO URLs! http://example.com/wordpress/ (where you run the wp-admin stuff from) and http://example.com/ (where everyone visits the site). When you do that, your .htaccess STILL lives in public_html but has this: RewriteBase /wordpress/

    So now do you see why it matters?

  13. garrityalf
    Member
    Posted 1 year ago #

    Mike,

    thanks for you reply and I agree I didn't think it would breach security if I would have answered your questions. But managers like to manage without them actually understanding what it is they're managing. Things like that are pretty much out of our control sometimes...

    Anyway, I was able to fix 3 of the region sites. I plugged in the htaccess code AND used a custom permalink and those 3 seem to work. Here is one of them:

    http://www.regions.noaa.gov/alaska/

  14. garrityalf
    Member
    Posted 1 year ago #

    On my testing server this morning, which is multisite enabled, I launched a new subsite. The main site is here:

    http://designerandpublisher.com/wp-testing/

    The new sub-site is here:

    http://designerandpublisher.com/wp-testing/virginia/

    so then i looked at the server, thinking there was going to be a whole new folder under wp-testing called "virginia" but there isn't, which surprised me since i'm used to making websites where you drop files into different sub-directories.

    anyway, i'm just glad i got the peramlinks (pretty) working now. i just fixed a 4th one and that one works too.

    the other 5 regions i now have to go in and install an htaccess editor plugin for each one so i can then fix those too. looks like you learn something new every day.

    PS - i was able to figure out how to design a website in Muse and then cut it up and incorporate WP into it. that's what you see here:

    http://designerandpublisher.com/wp-testing/

    so i'm pretty excited about having and understanding that capability now.

  15. so then i looked at the server, thinking there was going to be a whole new folder under wp-testing called "virginia" but there isn't, which surprised me since i'm used to making websites where you drop files into different sub-directories.

    Right, Multisite has NO subfolders. They're virtual, just like your posts! (You don;'t have domain.com/about/ as a file, right? Same idea).

    But let me explain.

    Your header on virginia is this: http://designerandpublisher.com/wp-testing/virginia/wp-content/themes/twentyten/images/headers/path.jpg

    This, on your MAIN install, also works: http://designerandpublisher.com/wp-testing/wp-content/themes/twentyten/images/headers/path.jpg

    So when your real site failed that test, I am suspicious.

  16. garrityalf
    Member
    Posted 1 year ago #

    Yeah I see what you mean. At this point, i'm just going to move forward and do as much as I can and fix the links like I have been.

    install the htaccess editor for the other sites that do not have it, plug in the stuff that i have and hope for the best.

    The web operations people aren't much help, i got shot down by manager for not being allowed to answer your questions, but thanks to you and reading up on other posts, i've at least been able to get what i can done for them.

    thanks again for your assistance.

Topic Closed

This topic has been closed to new replies.

About this Topic