Solved

Changing WordPress 4.0.1 Permalinks Breaks Sites Menu

Posted on 2014-12-17
10
214 Views
Last Modified: 2014-12-18
After installing WordPress, and getting halfway through my project, I discovered "permalinks". As an expert would know, the default is to reference pages with ?page_id=nnn. I discovered in the settings there is a "more friendly" look of simply using the page name, or "post name" it is called.

When I chose the permalink "post name" option, the menus stopped working.

I have searched the internet looking for answers. I have found tons of hits. they refer back to an apache server file named ".htaccess". This file is located in the root of WordPress. It contains two entries: BEGIN WORDPRESS, END WORDPRESS
I have tried to make sense from the searches I have found. Nothing makes sense to what I have seen.

Could someone tell me what I should put in that file to allow me to change permalinks to a "friendly page name"? A sample entry would be appreciated. My pages start out with names like "?page_id=114, and on up to 14 pages.
0
Comment
Question by:RayRider
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 5
10 Comments
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 40506165
Are your Permalinks on or off right now?  If off, turn them on and then check the .htaccess file.
0
 

Author Comment

by:RayRider
ID: 40506189
I assume they are on. I go to setting->permalinks and see the radio button selecting "default". When I select "Post-name", that is when the menu stop working. Apache gives the error "site not found".
0
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 40506193
Default = Permalinks off

So now the entire site stops working when you turn them on, not just the menu?
0
Why Off-Site Backups Are The Only Way To Go

You are probably backing up your data—but how and where? Ransomware is on the rise and there are variants that specifically target backups. Read on to discover why off-site is the way to go.

 

Author Comment

by:RayRider
ID: 40506234
The site stops working in respect that the site has NO problem launching from the base URL, www.sitename.com, However, when I click on a menu button (from the home page), I get the "not found" error. I have designed the site with anchors to paragraphs in the middle of pages using  html tag <a name="middlepage_target"></a>. Those anchor tags don't work, either.

I cannot find in WordPress anyway to configure it to work changing from the ?page_id=nnn, which you say is the default, meaning "off".

I guess I am misunderstanding what permalinks actually are. If I chose a permalink such as the "post-name", I have no clue what to do. I know that apache has to route the request to the virtual site. The configuration in apache's site-available only knows about either sitename.com, or alias of www.sitename.com.  So, if apache can route the request by using the non permalink name (?page_id) address, surely it can route the permalink "post-name" format, meaning it is something in WordPress that is not able to route using on of the permalink formats.

I bet the problems is in mySQL. I am guessing the database if looking for the raw routing = ?page_id=nnn

WordPress has no problems taking the non permalink address (www.sitename.com/?page_id=114#middlepage_target

This post has gotten too wordy. I hope I haven't totally confused you.
0
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 40506251
You're all over the place.

Do this.  Turn permalinks on (set to Post Name) and then look at the .htaccess file and paste the contents here.

When you created the menu, you did it all with custom links?
0
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 40506283
.htaccess should look like this:

# 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

Open in new window

0
 

Author Comment

by:RayRider
ID: 40506295
After setting to permalinks to Post-Name, here are the contents of .htaccess:

rrider@greece:/var/www/wordpress$ cat .htaccess

# 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
rrider@greece:/var/www/wordpress$

Turning permalinks back off, here are its contents:

rrider@greece:/var/www/wordpress$ cat .htaccess

# BEGIN WordPress

# END WordPress
rrider@greece:/var/www/wordpress$

Not sure what you mean by "custom links". I do not necessarily want a "blog site". this site is mostly static pages that I will update myself with maybe a comment page for user feedback and posts. All I did was create several pages. Next, I went to dashboard, appearances, menu and laid out the menu in the order I wanted it to look, including a couple of submenus. That is it! Nothing else.

I am a newbie with quite of bit of reading and video training in WordPress. However, this is my first site after I installed the server. I have been around IT for a long time. I just never did much web development, especially CMS.

This site is coming along just fine, and will continue just great even if I must stick with permalinks off. I just found it a bit intimidating to me because I never needed a use for the .htaccess file. After googling it, I was no better off understanding what it does to solve the permalink issue. That's why I came here to Experts Exchange.
0
 

Author Comment

by:RayRider
ID: 40506305
I see my .htaccess is the same as yours. What about permissions? Mine is:
-rw-r--r--  1 www-data www-data   36 Dec 17 21:41 .htaccess
0
 
LVL 70

Accepted Solution

by:
Jason C. Levine earned 500 total points
ID: 40506336
Permissions and .htaccess are not the issues.

Try this:

Turn permalinks on (Post Name).

Go to Appearances | Menu and delete your current menu

Rebuild the menu
0
 

Author Comment

by:RayRider
ID: 40507486
Thanks for the help.

Unfortunately, redoing the menu did not solve the problem.

Looking at my apache logs, apache is rejecting the "post name" format with a 404. If I knew more about the data flow, maybe I would continue to troubleshoot this.

From a curiosity point, I would like to solve this. But, from a practical point, I have spent too much on this. I can make it work without permalinks.

Many help blogs, including WordPress continue to point to .htaccess when links are broken from going to permalinks. Maybe on the next new site I will try them again.

Thanks again!!
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Do you think that WordPress is just for blogs?  Think again!  WordPress is really a fantastic all around platform that you can use to develop websites on.  Integrated into its basic functionality is the ability to create pages using your choice of a…
This article shows the steps required to install WordPress on Azure. Web Apps, Mobile Apps, API Apps, or Functions, in Azure all these run in an App Service plan. WordPress is no exception and requires an App Service Plan and Database to install
The purpose of this video is to demonstrate how to exclude a particular blog category from the main blog page. This is can be used when a category already has its own tab, or you simply want certain types of posts not to show up on the main blog. …
The purpose of this video is to demonstrate how to reset a WordPress password if you are locked out and cannot reset the password. A typical use would be if you cannot access the email to which WordPress would send the password recovery email to…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question