How does WordPress resolve public URL to pages? - wordpress

I am trying to understand how the URL resolution happens in WordPress. When a page is created/edited the internal link is something like the following:
example.com/wp-admin/post.php?post=165&action=edit
But to view the page, the URL used is something like the following:
example.com/about-us
How does WP resolve the public URL and generate the page?

As far as I can tell WordPress does this resolution using the .htaccess file. The rules are set in .htaccess to route the request to an index.php file which does the rest of the processing to generate the page.
This is specific to Apache. Other web servers may do it differently.

Related

Can Jekyll serve content based on a URL parameter?

I'm migrating a blog from WordPress to GitHub pages. In the logs for my site, I've noticed that there are many requests like this:
GET /wp/?feed=atom
This 301 redirects to the ATOM feed for the site.
I'd planned to use httrack to scrape my site and migrate all the static content. But this presents a problem. Is there any way to replicate the /wp/?foo=bar redirects using Jekyll?
You can use Jekyll redirect_from plugin which is one of the rare plugin that can be used on github pages.
The only problem is that yoursite.github.io/wp/?foo=bar from the server point of view is yoursite.github.io/wp/index.php?foo=bar. So, any ?foo=bar is resolved to the same file.
I you have only your xml feed to redirect, this does the trick :
---
layout: null
redirect_from:
- /wp/
---
content ...
If you have multiple files to redirect, you will have to switch to a javascript solution from a wp/index.html file.

How to rewrite wordpress category url

A have a wordpress theme, which has a built-in services module. All items in that can be found at domain.com/services/item. I rewrote a php file so links to these service items look like domain.com/something-else/item, but they point to the 404 page.
I would like to modify my site's .htaccess file to display the original domain.com/services/item content while users see domain.com/something-else/item.
I would like to use the url (something-else) instead the other(services) one, while keeping content the same.
Ha can I achieve this using .htaccess?
Just use the buit-in Rewrite API of wordpress :
http://codex.wordpress.org/Rewrite_API
Example : http://www.hongkiat.com/blog/wordpress-url-rewrite/

How to Remove redirection on magento site?

There is a problem on my client site.Due to some of the redirections set up for magento.. I am not able to access the wordpress pages.. Whenever I try to access a wordpress page, I am redirected to a magento 404 not found page.... so please let me know how to remove redirection on my magento site??
Your question is ambiguous. Is it the rewriting in .htaccess (or somewhere else) doing the redirect, or do they have redirects in the core_url_rewrite table that conflicts?
I would guess the former. You need to create an alias or location for your Wordpress area that are distinctly different from your Magento area. Often this is accomplished through a separate subdomain, like http://blog.example.com/ or through a suffix like http://www.example.com/blog/.

.htaccess: Codeigniter + Wordpress

I am developing site on Codeigniter and want to "connect" it with Wordpress.
So the URL structure will be
SITE-URL
-SITE-URL/folder1/
--SITE-URL/folder1/some-link
-URL/folder2/
...etc
What I need to do, is when Codeigniter throws 404 error, the content is taken from Wordpress website(same relative URL) without any redirects for end user.
Thanks
Not sure you can do this with .htaccess since .htaccess can only do re-directions before the content is served, meaning before Codeigniter has responded to the request. So when Codeigniter generates a 404, it's returning content an .htaccess isn't processed.
What you would need to do is generate a 404 controller that either does a redirect, which you don't want, but would be the easiest. Or the 404 controller would then have to load in wordpress and process the request through there. Something similar to proxy, but it will need to be done with PHP.

Drupal 7 - rewrite all urls for a specifik page

I have a page (shop) in my drupal 7 site. On this page is a php script requesting a webservice.
The response depends on the URL, eg. /shop/pid-1234/pink-shoes.html will show a product with id 1234.
I therefore need Drupal to load the /shop page no matter what the URL after shop/ looks like. How do I
achive this? I have tried using wildcards in the URL alias module ($,%) but that didn't work. I have also
looked at pathauto and redirect, but didn't seem like they could help.
Any suggestions?
You probably need an Apache mod_rewrite rule. You can add something to your .htaccess file if you're using one.

Resources