Questions tagged [url-rewriting]

Refers to the process whereby an URL is manipulated to create what in WordPress is called a "pretty permalink"

701 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
11
votes
1answer
671 views

web.config conflict on IIS

folder structure docroot |- wordpress |- web.config |- wp-content |- japi |- index.php \- web.config ... ... As you can see there are 2 web.config s....
4
votes
1answer
663 views

Detect page type by url (Archive, single, page, author,…)

Update:Really short version How do I get $wp_query for a given url which can be anything (single, page archive, custom post type, author, year, month,...)? TL;DR I need a function which can return ...
4
votes
1answer
1k views

Add category to custom post URL

I am trying to create custom post with custom taxonomy and categories. Structure is like: Product: Has categories Has taxonomy Custom post type create: function create_alco_custom_post() { $...
4
votes
3answers
3k views

Use subdomain for certain urls

I have the following rules in my .htaccess file on a WordPress (single installation): # REWRITE FORUMS DOMAIN TO FOLDER RewriteCond %{HTTP_HOST} ^forums\.example\.com$ RewriteRule !^forums/? forums%{...
4
votes
1answer
1k views

Custom taxonomy on permalink

I have a long time problem and look forward for your help. I have a custom taxonomy of "city" (it is no hierarchical like tags). I just would like my URLs to look like this: /%city%/%category%/%...
4
votes
0answers
2k views

get_permalink returns default link

I hope you can help me. So I'm using /%postname%/ as permalink structure, and my htaccess looks like this: # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase /develop/...
4
votes
2answers
1k views

How to remove “admin.php?page=” from wp-admin using .htaccess?

I'm looking to use .htaccess to rewrite admin page URLs. I'd like to change it from: http://example.com/wp-admin/admin.php?page=whatever&id=5&var=10 to http://example.com/wp-admin/whatever?...
3
votes
1answer
1k views

Home page with Polylang redirects to other page

On my website : https://www.littleguestcollection.com/, the homepage is redirected to other page (this one : https://www.littleguestcollection.com/fr/hotels/lux-tamassa/). I have no idea what is the ...
3
votes
0answers
992 views

Add parent/child taxonomy to custom post type url

I have seen several cases of one taxonomy being added to a custom post type url, but I have modified that function to include a parent and a child taxonomy term. However, I am getting a 404 when I go ...
3
votes
0answers
133 views

How can I rewrite a plugin generated URL?

I'm using the wpForo plugin to create custom profile pages on the front end of my website. The profile URLs generated by the wpForo plugin look like this: example.com/community/profile/username/ ...
3
votes
1answer
237 views

Using a custom field value to redirect away from a 404 page

I’m moving from an old CMS to WordPress. The old articles are saved as posts and the new WordPress permalink is %post-id%. The old URL slug is unique and saved as a custom field for each post; the ...
3
votes
0answers
2k views

Category base to url in custom post type/taxonomy

I'm building a recipe site that uses custom post types for recipes. So I searched for including the custom post type categories in the url and found a solution below by Milo. It rewrites the url and ...
3
votes
0answers
248 views

How make a multi language routes, with rewrite rules or rewrite endpoints?

I want to know a concept of making a multi language routing system for WP. That is the best practice, to make this routing system with add_rewrite_rules for pages post archive etc in part, or to use ...
3
votes
0answers
338 views

Cache issues with redis and nginx

I have a problem with the rewrite rules in my nginx config file. I am running wordpress with nginx and redis to cache the site. I can get the redis to cache all pages not a problem, but as I am ...
3
votes
1answer
180 views

Plural Category Base Slug On Category Archive Page

I've got a little problem with the category base slugs. Say I have got a category called 'Resources', with the category slug set to 'resource'. So any post in the category resource will appear with ...
3
votes
1answer
668 views

Changing a custom post type “has_archive” after registered

Ok, I've seen some similar posts on how to change a custom post type's attributes after it has been registered (in my case, I'm trying to modify a custom post type created by a plugin without ...
3
votes
0answers
350 views

Evaluating a external rewrite rule before internal wordpress rewrite rule

I am been plucking out my hairs since last few days trying to solve this problem: I want to convert my urls from format http://example.com/prodsearch/category/tag1-tag2-tag3-tag4 to http://...
2
votes
0answers
42 views

Rewriting Woocommerce Product Filters To URL Segments

I'm working with a site where product category pages are filtered using query parameters: ?color=red&brand=nike&size=10 I'd like to use URL segments instead and rewrite the request to the ...
2
votes
1answer
358 views

Bulk 301 redirect for custom post type

I've amended the URLs for my custom post type from: url.com/jobs/job-name to url.com/jobs/job-location/job-name Problem is, because this isn't a standard rewrite wordpress doesn't do the 301 ...
2
votes
1answer
355 views

Flush Rewrite Rules on init or rest_api_init?

if I'm using the REST API to create endpoints in my plugin, should I be flushing rewrite rules on init or in rest_api_init? I realize that it should be done on plugin activation/deactivation. However,...
2
votes
0answers
286 views

Custom URL rewrite to specific page template

I have a standalone page with the slug: hubv2 that is using a custom page template which runs a small React app. The React app handles in browser routing and it works fine. For example I can hit /...
2
votes
1answer
54 views

Difficulty with rewrite rules

I can't work out how to combine a rewrite rule and a custom query var. I have created a custom 'edition' template, which calls an external API to populate a table with details of a particular book. ...
2
votes
0answers
67 views

Multilanguage URLs

I am trying to achieve multilanguage behaviour for my website. I'm very close but not quite there and feel like I'm running in circles. That's why I decide to ask for your help. I'd like to use URLs ...
2
votes
2answers
2k views

How to append a URL parameter to all outbound URLs

Is it possible to append ?ref=myref to all external URLs? If so I'm guessing I will also need to check if a ? already exists and use & if so. I'm a WP noob just coming from Joomla, any tips / ...
2
votes
0answers
147 views

Custom Category/Subcategory structure

I am building a site with several sections, and one of them is a special page to navigate through categories in a hierarchical style (you can navigate into categories/subcategories and see their ...
2
votes
0answers
35 views

Keep taxonomy base name in post permalinks

I have a custom taxonomy (I'll call 'issues' in this example) registered as such: register_taxonomy('issues',array('post', 'pieces'), array( ... 'rewrite' => array( 'slug' => 'issues', ...
2
votes
0answers
52 views

rewrite_rule for custom post type doesn't affect get_permalink

I have a custom post type named course. I added rewrite rules so I can include post_meta data in the URL. /* Rewrite URLs for generate dynamic template */ add_filter( 'generate_rewrite_rules', '...
2
votes
3answers
337 views

Permalinks when filtering multiple custom post types by single taxonomy

I've been working with Custom Post Types and Custom Taxonomies for ages but one thing I can never get right are the rewrites when applying a shared taxonomy to multiple CPTs. For instance, I have ...
2
votes
1answer
310 views

Wordpress .htaccess - route other URLs to another app

I need help in WordPress .htaccess. My projects name is Project this is WordPress and onepage website, inside this I have one more project that is built in CI named app. What I want is, if someone ...
2
votes
2answers
285 views

WordPress plugin Write User/staff ID as the same as the WordPress User ID

I have a question in regards to a WordPress plugin (Bookly) that creates a Staff ID for an already created WordPress user, and hopefully, somebody may be able to help me with. Currently Bookly adds ...
2
votes
0answers
129 views

How to change the URL pattern for single post view

I have a Custom Post Type registered as "News" And there are 2 taxonomy being assigned to this Custom Post Type i.e News Category, News Country Right now if I am previewing the single news page, the ...
2
votes
0answers
48 views

Removing “category” from URLs then “add_endpoint()” won't work…

For example, the original URL would be http://localhost/category/sub_category/. What I want is http://localhost/sub_category/, furthermore, I want to add an endpoint to the URL which looks like http:/...
2
votes
1answer
753 views

Rewrite sub folder dynamically with country code in WordPress using PHP

I know this question has been asked so many times but I didn't find any working solution or example which I can use to fix my problem. I have been working on a client site. There are two similar ...
2
votes
1answer
849 views

How can I make Wordpress work with a Symfony app?

Basically, I have a website built that has two components. One component is the the WordPress part, under "/". And the second component is a Symfony app under "/foo". How can I make Word-press ignore ...
2
votes
0answers
726 views

change default 'post' slug with register_post_type_args

I'm trying to change the default slug for default wordpress post. With register_post_type works fine with this code: add_action( 'init', 'my_new_default_post_type', 1 ); function ...
2
votes
0answers
121 views

Add 'articles' prefix before blog posts url without affecting pagination

I tried this solution for adding 'articles' prefix before blog posts on URL. function filter_post_link($permalink, $post) { if ($post->post_type != 'post') return $permalink; return '...
2
votes
0answers
137 views

wordpress multisite subsite rewrite rules not working for videos

We have an issue on our site whereby videos uploaded to posts on subsites are returning a 404 when attempted to be viewed, whereas for instance images attached to subsite posts display just fine. We'...
2
votes
0answers
148 views

Rewrite my default post URL

I want to have this URL structure for my default post type : domain.com/blog/{post_ID}.php For other pages and post, I want a classic URL like : domain.com/page/sub-page/sub-sub-page/... In the ...
2
votes
0answers
54 views

Map alt domain to specific section of website w/o MU

I have one website on which I want to use multiple domain names. The URL pattern on the existing looks like this: Main domain: - shop.com - shop.com/products - shop.com/...
2
votes
0answers
540 views

Custom WP TItle from custom template with dynamic URL structure

I am new to custom WP development, but I have made a custom plugin. With a custom rewrite I have made the following URL structure: /profile/[company_name]/ I have made a new post Profile with a ...
2
votes
1answer
949 views

Rewrite URL - insert custom variables as a directory path

I'm trying to re-write permalink structure with my own custom url in WordPress for a Divi Theme "project" I have already changed the "Divi slug" from "project" to "prodotti" so currently, the URL ...
2
votes
2answers
2k views

Add a query string to ALL links on site

Our client would like to embed his site into an iframe in their software backend. I get a query string on the first link but need to make sure that string persists across URLs for all links and ...
2
votes
1answer
499 views

custom taxonomy and custom post type url conflict

i am having one serious url issue. there is news custom post type. it's slug is news. News taxonomy slug: news_category News taxonomy url is: http://domain.com/news_category/press-release i want ...
2
votes
0answers
195 views

changing comment-page-# to something like review-page-#

When you enable pagination for comments in wordpress the typical pagination page for a comment is "comment-page-1" "comment-page-2" etc. what I want is this to appear like "review-page-1" "review-page-...
2
votes
1answer
194 views

Get the category is not working on url

Although this is my first post but i have been coming here for answers so I know the rule and this isn't a duplicate because i have tried whatever i could but couldn't seem to get my codes to work. ...
2
votes
0answers
361 views

How to Combine Two Custom Post Types into Single Permalink Structure

The website uses - A) A hierarcical Custom Post Type "Destination" to support the following structure, so each tier of the hierarchy could have its own unique destination guide: Territory - ...
2
votes
0answers
956 views

Pretty URLs for Custom Post Type & Custom Taxonomy with Duplicate Slugs on WPML

I'm interested getting some help for a rather complex setup. I'm working on a publication and interested in creating a special subsection with a custom taxonomy. Think of this as an editorial ...
2
votes
0answers
2k views

Custom Post Type and Custom Taxonomy Permalinks

I'm currently working with a client's Wordpress blog that has a permalink structure set in the admin settings as "/speaks/%postname%/". This is so that all actual blog posts (post_type=>posts) have ...
2
votes
0answers
562 views

One WP install, I need to map a custom domain name to each category

I've read other answers but they weren't satisfactory. Multiple blogs, different domain names, one install to rule them all Multiple Domain Names - One WP Install (non-Multisite) - Default Each ...
2
votes
1answer
161 views

Pagination problem

I have two custom rewrite rules: add_rewrite_rule('foo/bar/?', 'index.php?post_type=foo', 'top'); add_rewrite_rule('foo/bar/([a-z]+)/?', 'index.php?post_type=foo&bar=$matches[1]', 'top'); Which ...

1
2 3 4 5
15