Creating Links inside of Wordpress properly? - wordpress

I'm trying to create wordpress links using direct links inside of the same wordpress site, say for example...
I would have a <a href="/catagory" >Catagory</a>
I noticed that sometimes, the links might stack on top of eachother on the urlbar when I click on the links from a different page?
say for example it would click on another link then it would turn out to be something like
"www.myWordpressSite.com/catagory/catagory"
Whats the proper way of doing this? Would it be something like

The first /category is what's called a "category base". You can edit it in Settings, Permalinks page.
The second /category is your cateogry
There are plugin to completely get rid of the category base, search WordPress plugins for "no category base" (that's how the plugin is called, nice, huh?)
EDIT:
Um... now I'm not sure I understand the question now after an edit, but if URLs "stack" then you should make sure that they wither start with a / or with a http:// (or https://)

Related

How to redirect a subpage of one website to another domain?

My question is simple, let's say there is a website created by WordPress with its URL:cuaauc.com, and it has so many sub-pages, including one named cuaauc.com/contact/. I would like to redirect the cuaauc.com/contact/ to other content from my external domain test.com. I understand how to direct cuaauc.com to test.com, but I am not sure how to do the subpage situation.
Please give me some advice, or tell me if this is impossible to work out.
If you just what to set the link for the navigation item in your wordpress site (so that the button 'contact' directs to an external page), you can do this in wordpress backend under Design -> Menus and make the menu item an individual link and set the url.
You can also make a page-template (page-yourpage.php) and set the redirecting in your php file or include (php include or via iframe) the content of your target contact page.
There are also more ways to achieve this.
If you like you can write a little bit more about what you are exactly trying to achieve and why you want to have the contact page being seperated. This way the we can give you better help and can decide which method suits your needs best.
You can use a plugin called Redirection.
After Install an Activate plugin, go to Tools > Redirection
If you are using first time this plugin, you may have to set up this plugin by simply a few clicks.
Then you can add new Redirections rule by click on Add New button.

Add php variable into Wordpress custom menu

I've been trying to figure out how to add a php variable into my WP navigation links.
Let me explain:
I'm gonna set a cookie on the very first page of my website, when the user clicks on one of 4 types of profile:
-family
-pro
-seniors
-cadres
Currently, I have a theme switcher extension wich modifies the WP theme depending on those prefixes:
http://mywebsite.com/family
http://mywebsite.com/pro
http://mywebsite.com/seniors
http://mywebsite.com/cadres
... etc
The colors & content of the 4 "home" pages are different, but I'm using the WP navigation menu (wich remains the same on every page, so the prefixes disappear when clicking on its links).
Initially, I wanted to modify my menu links like that:
https://mywebsite.com<?php if (isset($_COOKIE['profil'])){echo '/'.$_COOKIE['profil'];} else{} ?>/navigation-link1
Here:
menu
But I can't add php here, and the solution is not ideal because it would only apply to the menu, and not the posts permalinks (I want some posts to be available regardless the profile and I don't want to duplicate all my posts).
Ideally, I would like to have a solution to set the WP theme directly based on the stored cookie. This way, it would also apply when the users click on a post permalink.
I've read things about a "walker" but I don't know what it is, wp_nav_menu_objects, but I didn't understand what files to modify nor wich code to use.
I always search the web to find my answers, but I'm french and I think my understanding has reach it's limits, so if somebody could take the time to explain to me like I'm 4 years old :), I would be grateful.
Thanks

Put categories on PAGE url wordpress

Ok, here is the thing I have already added the categories to the pages (with the help of a plug-in, it's called Add category to pages) and so now I want to change the URL to display the categories (that is to say I want my pages to have this estructure: mysite.com/%categories%/%page_name% right now it has his structure: mysite.com/%page_name%), I have tried to google it but I can't find a straight answer. So if anyone has some resources (tutorials, articles) or some idea (if it's not to much to ask with code examples) on how to achieve this it would be fantastic. (And believe me, I'm asking as my last resource)
you can do it easily with "Page Parent" option available in WordPress.
Steps To create a subpage
Go to Administration > Pages > Add New screen.
In the right menu, click the “Page Parent/No Parent” drop-down/page attribute widget. The drop-down menu contains a list of all the Pages already created for your website.
Select the appropriate parent page from the drop-down menu to make the current Page a child Page.
Add content to the subpage.
Click Publish when ready.
Output - https://example.com/asia/india/
More Info. - Wordpress Subpage Permalink
well you can do this for categories and products from permalink setting, but if you want to manipulate the page url according to yourself then you need to create an blank page with the prescribed name whichever you want to insert, i.e, if you want to insert amazon within the url then create an url with name of amazon, and put the other url's under this parent page.
This way your url will look like
http://example.com/amazon/page_name
Unable to post as comment so directly posting it in an answer, in WordPress you can have custom URL. After you logged I'm as admin under dashboard you have general settings where you can put custom URL's like http://example.com/%caregory%/page_name
For more reference also checkhttp://codex.wordpress.org/Changing_The_Site_URL
I don't know if you tried this but after you login as admin, under Dashboard>>Settings>>Permalinks>>Custom Structure.
Let me know if you have already tried that.

Permalink Linking Issues (Wordpress)

My current blog is www.bostonsbettah.com and my current permalink set-up is http://www.bostonsbettah.com/%category%/%postname%/
Now, in a perfect world, the a post should appear as something like www.bostonsbettah.com/bostonbruins/boston-bruins-1st-line-playing-like-a-1st-line/ and that should take you to the post. When I click on the page title at the top such as "Bruins Blog", it should take me to www.bostonsbettah.com/bostonbruins/ that has an archive of all posts categorized as "Bruins". Currently, however, every page besides the home page is a 404 error.
Now I know I can fix something in the .htaccess file and I know how to access it, but I don't want to mess with it as I don't know how to code. Is there a fix someone can provide that will allow me to fix my website? Thank you in advance.
Never,ever,ever put your blog URL inside custom permalink structure!. You must use one of the structure tags, or a combination of tags only.
Read the documentation first.

Wordpress - Page Aliasing

I don't know why I am having difficulties finding an answer for this, but I was. I am hoping it's quick and painless.
This is my first attempt at a WordPress site. I created a number of pages which reside in a standard navigation. Currently the nav links look like such:
?page_id=2
I want link to be friendly such as:
/restaurant/
I went into the permalinks and tried messing around with the options and I got the URLs to change but on click I get a 404. What am I doing wrong?
two things i could think of
Wordpress can't write the .htaccess file (a warning should be displayed on the permalink page). In that case update it by hand with code shown on the site.
mod_rewrite is disabled on your server http://httpd.apache.org/docs/current/mod/mod_rewrite.html

Resources