I'm trying to setup a permalink structure like so 'example.com/post/post_id/any-text-here'. Which is kinda similar to how SO's permalinks to questions work. If the last part is changed it still loads the right page as long as the first part contains the correct question ID. I'm not sure if it's redirecting or pushing the question title back into the URL when you do that though.
I've tried /post/%post_id%/%postname%/, but that requires the correct post title in the url. I want that portion to not matter, but still have the flexibility in being able to place a title in it.
I'm guessing some server configuration changes may be required. I'm running NGINX.
Your proposed structure of /post/%post_id%/%postname%/ appears to work perfectly for me. http://domain.com/post/1/anything/ correctly redirects to http://domain.com/post/1/hello-world/, where hello world is the post title.
If this definitely is not happening for you, try disabling all plugins temporarily - something could be re-interpreting the url structure.
Related
Every post permalink takes me to last published post.
For example both
http://randomwebsite.com/?p=554 and
http://randomwebsite.com/?p=556
Take me to same article, and it is always the newest post.
I tried changing permalink structure, and reinstalling WordPress, but still no go.
It is very strange problem and I never had it before.
Any ideas why this could be happening?
As Joren mentioned in the comments, this sounds like it could be a template problem. That is, your post data may be loaded as it should, and your permalink structure may be fine, but if the posts are being routed to a template file which is hard-coded to display only a single (most recent post) then you will have this problem.
You can confirm this is in fact the problem by switching to another, more standard theme, (like twentytwelve,twentythirteen...) and verify that the issue is resolved.
If that indeed does fix the problem. Try to determine which template file is being loaded in your theme by digging around in the source (the files are found here: wp-content/your-theme/template-file.php) or by reading this page of the WP documentation: https://codex.wordpress.org/Template_Hierarchy. Then debug the code as necessary.
It seems like others have experienced similar issues as me in the past on this subject, but nobody has provided a complete answer.
I'm attempting to run a PHP script to update the permalink structure in the wp_options table for a slew of Wordpress blogs. I want to connect to each database and update the permalinks without having to log in to each blog and update the setting through the UI.
I'm successful at connecting to the DB and updating the permalink_structure field with the proper codes, but it causes a 404 when attempting to view any posts.
Is Wordpress updating other tables/fields to fully enable the permalink?? I'm having a hard time finding the complete answer to this.
BTW: If there are edits being made to the .htaccess when this is done through the Wordpress UI, I'm not seeing it. The htaccess looks unchanged when I do this through the UI.
Thanks!
Wordpress permalink rewrite_rules are kinda troublesome. They are great if you wanna do basic stuff, but it's damn hard to do some complex rules with it.
What exact structure you wanna use?
Remember that htaccess created by Wordpress just redirects everything to index.php, which loads Wordpress system (wp_load()), and one of its components parses REQUEST_URI.
First it tries to to bind REQUEST_URI into one of its regexes, which makes it understand what kind of resource is being requested (category, tag, page, post, etc), then it tries to find which resource it is (if it's a post, find which post by it's slug).
I need to locate the file that manages the main page of my online store developed with Magento (which would be the index.html). I just need to change a link, and I've used Firebug shows that the file i need to edit is "misitioweb.com" (the main page) but the document itself does not appear in the ftp. The initial page consists of a bunch of XML, and PHP's PHTML. If someone wants to see the address page is http://peluches-cel.com and only want to change the destination URL of the link "Peluche del mes". I have used the help of Magento to show "Help template route" and I downloaded the 4 files that are more likely to manage that area of the page, but I can not find the part where specify the destination URL of the link. I have always worked with HTML or PHP separately (I have little experience with PHP) and I find it very difficult to understand how Magento builds each website. If someone could give me a little hint on how to achieve change that link would you do me very happy, it took a long time trying it on my own and looking online but can not find how to do any guestbook or forum that explains how to work well with Magento, in my language, there are hardly any documentation on Magento, so I decided to try my luck in this forum and I've read on several pages that involves many professionals in the e-commerce. Thanks in advance to all who devote their time to read my question.
I don't really understand what you want.
But if you want to change the base URL, you can do that by accessing database via phpMyAdmin, find the table core_config_data and change the URL in the web/unsecure/base_url and web/secure/base_url to what you want.
Not the url of the page, but the url of a link. Try clicking on "Peluche del mes" and see what comes out, gives access to http://www.peluches-cel.com/peluche-del-mes, I want access to http://www.peluches-cel.com/oso-tiziano-2col-40cm directly. The problem is NOT EXISTS peluches-cel.com/oso-tiziano-2col-40cm page on FTP, to be done in PHP there are different functions that are responsible for creating it at the time of the request I need to change the link to "Peluche del mes", if you see with firebug or any other source code analyzer, the source code of the page you will see that line 146 is managed that link, but I can not directly access the code ¿do you understand me? through an ftp client no such file or html as php magento works with the model view controller, that's my problem. Thank you again.
I have a problem.
I ma moving a system from one server to another and I came across a peculiar problem. There are some pages placed in a subfolder like these:
xttp://test.domain.com/admin/oders.php
xttp://test.domain.com/admin/users.php
xttp://test.domain.com/admin/whatever.php
Now, when I move around the pages, via some simple menu with links I get most of the times correct hits. But from time to time I end up on say:
xttp://test.domain.com/admin/admin/oders.php - which obviously causes 404
When I go back to previous page and press the link again it again works all right. Also when I hover over the links they always show proper paths regardless of whether I am going to get 404 or not. All links are dynamically generated by the scripts but they work perfectly on old server and as I say to a naked eye it all looks OK, right until I press the link.
Anyone has an idea where to look for a bug or which tool to use to see what is happening when I press the link? URL mod rewrite? Domain configuration? I am at a loss.
It sounds like the scripts are getting confused between
[xttp://test.domain.com]/admin/file.php
admin/file.php
file.php
Without seeing how the URLs are generated it's impossible to say how this is happening.
I have a problem because I dont't understand system of links in contao (http://demo.contao.org/) but not only in this CMS, Can you help me?
So:
We ALWAYS have link as:
www.something.xx/title-for-example-news.htm,
And the extension is always htm (never php!), no have id of e.g news, is it a good solution? How does it work?
I know way that we have a link for example www.sometking.xx/321-title-for-example-news.htm,
where 321 is id news so we can get easy and fast date from e.g. database, and no colision.
How does it work in contao case? it is fast? Maybe static array of routing? What do you think about it? It looks very pretty but is it fast?
Just came across your question by chance. If you're still interested, here you go.
It's just as fast as the link with the id included. Both systems work by looking up the page name or id in the database; contao stores the permalink in the alias column of tl_page.
There is an issue if you alter the page name / alias though: contao does not have a fallback to the id if the alias is not found, so browsing the old page name returns a 404. This differs from Wordpress, for example. Wordpress will never changes the permalink even if you change the name of the page or post. After all, a PERMAlink should never change!