Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [rewrite-rules]

Rewrite rules modify a web URL's appearance. This modification is called URL rewriting. Rewritten URLs (sometimes known as short, fancy URLs, search engine friendly - SEF URLs, or slugs) are used to provide shorter and more relevant-looking links to web pages. The technique adds a layer of abstraction between the files used to generate a web page and the URL that is presented to the outside world.

0
votes
0answers
13 views

plugin: rewrite rules are lost when WP updates

I'm developing a plugin, and noticed that my custom rewrite rules are lost after WP updates its core. It's no big deal, it works again if I disable/reactivate my plugin. But since I would like to ...
0
votes
0answers
12 views

Url rewriting for wordpress custom page

hi i need some help on my wordpress custom page i try this page show fine and geting data from variable our main post look like example.com/windows/skype i create download page for it which look ...
1
vote
1answer
14 views

Nginx Wildcard SSL with Wordpress Multisite Subdomains

I have a wildcard certificate that secures *.example.com and I need to strip out the canonical www for all requests made for subdomains, eg: www.subdomain1.example.com => subdomain1.example.com I ...
0
votes
0answers
12 views

Mask page with subdomain [closed]

I have a site: somesite.com We need careers.somesite.com to open somesite.com/careers but not redirecting, masking this page. careers.somesite.com => somesite.com/careers Tried Multiple Domain ...
2
votes
1answer
28 views

Disabling post_type in URL

I noticed that by default, WordPress lists all posts if you use mysite.com/?post_type=post at the end of the URL. What's the simplest way of deactivating this? I would prefer it redirected to my 404 ...
0
votes
1answer
24 views

Custom Redirect Rule For My Site [closed]

How can i write custom rule for my posts in my wordpress site >> wordpress redirect example.com/?p=123 to example.com/postid123 at default. but i want to write a rule that when a user opens a url like ...
0
votes
1answer
20 views

Custom permalink question

I have a multisite environment where I am switching databases to retrieve data in a custom post type entered on one site to show on the other site. On the site where the data is not stored (and the ...
0
votes
2answers
26 views

Wordpress pass url to page template when page does not exist

I created a page template to serve information dynamically. For url like example.com/the-hamptons => index.php?page_id=92&filter=the-hamptons For url like example.com/page-that-exists <- ...
0
votes
0answers
24 views

How can I use a custom PAGE taxonomy?

My site serves an organization with about 20 committees. I would like to have a custom archive page for each that contains (roughly) a post of custom-type-1 for that committee, then a post of custom-...
1
vote
0answers
11 views

Rewrite: WordPress URL rewrite on Search

I am trying to create a URL rewrite in wordpress. I am creating a search from through wordpress. The URL structure I currently have is the following: http://localhost:8888/?post_type=CustomPost&s=...
0
votes
1answer
35 views

Disable WordPress Archive Conflict Check

I want to have numerical slugs in WordPress for pages but WordPress doesn't allow this by default in an attempt to preserve the slugs for use by chronological archives. The wp_unique_post_slug ...
0
votes
1answer
22 views

Add parent post to Custom Post Type [closed]

how can i add a parent post to my custom post type ? I found an example : function codex_custom_init() { // Our People $people_label = array( 'name' => 'People', 'singular_name' => '...
0
votes
1answer
15 views

Problem with Paging 404

On my Wordpress site, house is a page with short code written in it to paginate a get terms loop. Currently below urls works perfectly to return 2nd page of the loop /house/?paged=2 /index.php?...
0
votes
0answers
13 views

Pretty Post Type/Taxonomy URLs for Archives While Keeping Post Type/Post URLs Intact

This question expands the following: Permalinks: custom post type -> custom taxonomy -> post This works all well and good... however, I have an existing site that I'm trying to improve and, ...
0
votes
0answers
14 views

Add custom rewrite rule when dismatch a part of string

I have a WordPress site and I have case that needs the following url: http://www.domain.com/compare/productA to be rewritten to: http://www.domain.com/compare?product=productA but at the same time ...
0
votes
1answer
19 views

Redirect Custom Post Type from Child Taxonomies

I have created a Custom Post type and its own respective taxonomy. I have for example this URL structure: http://www.example.com/faq/category/sub-category/test-post/ The same content can also be ...
0
votes
0answers
37 views

Rewrite rule not working, suspect redirect string

These rewrite rules are killing me. It is probable something little, but I can't find it. I have a custom post type called 'tournament', it's permalink structure looks like <domain>/<...
0
votes
1answer
31 views

Rewrite Page Parameters

i have a page call "city" http://localhost/wordpress/city/ and it get details from mysql by url id like http://localhost/wordpress/city/?id=paris and i want to change it like http://localhost/...
1
vote
1answer
32 views

Custom rewrite not working

I'm trying to rewrite URLs on my wordpress site to match Googles "seo friendly" policy. I want to rewrite URL's for 3 types of queries generated from search plugin: a) Location example.com/used-...
0
votes
0answers
21 views

Comparison between multiple products

I have a wordpress problem. https://www.vpnmentor.com/vpn-comparison/nordvpn-vs-vyprvpn/ kindly go to this link. You should see a comparison between 2 products. I want to achieve something like ...
0
votes
0answers
30 views

add_rewrite_rule causes redirect to homepage

I want to create an alias url for my homepage so that it can be accessed at / but also /alias I've set up a rewrite rule but it just causes a redirect to / add_rewrite_rule( '^alias?', '...
1
vote
2answers
42 views

I need a custom permalink for my website

I have following scenario: my-domain-name.com/google.com my-domain-name.com/twitter.com I need a custom permalink structure to pass google.com or twitter.com to domain_name query variable. I have ...
0
votes
1answer
46 views

Pretty URL via Rewrite

I'm building a dynamically populated profile page for my site users. This currently uses the following URL structure: https://example.com/members-list-profile/?&uid=XX I'd like to improve the ...
0
votes
1answer
31 views

Custom URL routes

I'm a newbie in Wordpress, so excuse me if I ask a noob question. I want to redirect some of the URLs to a specific page (single-deal.php). Now, these set of URLs (regex provided for these URLS) does ...
0
votes
1answer
45 views

How to change url for taxonomy pages?

My Wordpress default category has 'news' category term. I created custom post type with name 'artist' and custom taxonomy named 'genre'. Now what I set in permalink section is below custom structure -...
0
votes
0answers
44 views

Sometimes I am still getting 404 error if I call add_rewrite_endpoint & flush_rewrite_rules on activation / deactivation hook

I need to add a custom tab to my woocommerce my account page, so I followed this article: https://github.com/woocommerce/woocommerce/wiki/Customising-account-page-tabs#creating-new-endpoints /** * ...
1
vote
1answer
68 views

Rewrite Rule for default post type

I am using two post types into my site: a) Post ( default post type ) b) Program ( Custom Post Type ) I am trying to add '/blog/' string to default post type URL. If I am tying to do it from permalink ...
0
votes
1answer
26 views

Help adding custom url, rewrite_rules_array

I'm trying to get a rewrite_rules_array rule to work and running into issues. I would like to add a rule so that when someone visits: http://domain.com/product/foo/bar It essentially loads: ...
0
votes
2answers
44 views

URL rewrite problem in WordPress plugin

I am having some trouble getting rewrite rules to work as I want in my a WordPress plugin. I added a rewrite rule: add_rewrite_rule('some_url','some_redirected_url', 'top'); The rule is written to ....
1
vote
1answer
27 views

add_rewrite_rule ignoring other params than the “p” param

A specific post on my website has a shortcode that uses a parameter called "query" to produce its content. So, this is an example of a working URL: https://example.com/my-post?query=980 "my-post" is ...
0
votes
1answer
80 views

Associate the “add_rewrite_endpoint” and “$_GET”

I have an i18n class. The class find lang tag. For example: "?lang=en" And i want it work with subdir. For example: eg.com/en and eg.com/hello-world/en For this i am using: add_rewrite_endpoint ...
0
votes
0answers
27 views

custom rewrite rules will not be added to wordpress rewrite_rules database

I want to make rewrite. this is my rewrite code: function coinDedicatePage_rewrite() { global $wp_rewrite; add_rewrite_tag('%coinName%', '([^&]+)'); add_rewrite_rule('^coin/(.+?)/?$...
0
votes
1answer
265 views

Trouble with question mark in rewrite rule

The url I am trying to rewrite looks like this. root_domain/something/something-else/also-different-1030/?success=1289 With this rewrite rule I am trying to catch the url and direct it to the post ...
0
votes
1answer
28 views

rewrite rules problem with #comments-2345

I am trying to created new rewrite rules for sth like this www.myweb.com/question/#comments-2345 where 'question' is TAG and the #comments-2345 suppose to be recognized and read by get_query_var. '#...
0
votes
0answers
19 views

Rewrite Rules and redirecting problem

I have this code which works fine for another users environment but not my environment. Tried to flush cache, flush rewrite rules etc.. The page just redirects either to the homepage or to the ...
0
votes
1answer
28 views

Custom WordPress Pages

Recently, I have started developing a WordPress Events plugin as none of the off-the-shelf ones met the specific criteria for this project. I have ended up creating a few database tables for tracking ...
0
votes
0answers
25 views

How to inject dynamic parameters into url pathinfo for all site content

Similar to this question here, but modified for my purposes: I want to inject into all urls of my website a country. For example: https://www.example.com/contact should be accessible by https://www....
0
votes
0answers
24 views

How create url rewrite for 3 different taxonomies in the same Custom Post Type

Hello I have a custom post type called "vehicles_cpt" to this are linked 3 taxonomias (year, make, model) I need to write a url like this https://localhost/2019/volvo/x7 redirect to the post that has ...
2
votes
1answer
74 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,...
1
vote
0answers
169 views

Rewriting “pretty” blog category URL with htaccess / add_rewrite_rule() causes 404 page

I'm migrating a site between hosts and am having issues with what should be(!) a fairly simple rewrite of a "pretty" URL to display posts filtered by category. domain.xyz/category/cat_name/ => ...
1
vote
0answers
20 views

Use “search” in permalink?

I am currently in the process of migrating a custom web app to WordPress and in the custom app, search requests have a URL structure of mydomain.com/search?q={search criteria}. I attempted to add ...
0
votes
1answer
178 views

Custom rewrite for product variation not working

I'm trying to rewrite the product variation url for a Phone Model attribute for example to this url: index.php?product=example&attribute_pa_model=iphone-x This works when I open it in the ...
1
vote
0answers
51 views

Plugin action rewrite rule - non_wp_rules

The wp rewrite rule I added to my plugin is not working. Here's my setup: Scenario I'm trying to get the site's ads.txt to pull from my plugin's ads.txt. eg site.com/ads.txt pulls from wp-content/...
0
votes
0answers
33 views

Why is there a 404 on page 2+ for my search page?

I've overridden the search.php template from within a plugin, and I've replaced the global $wp_query with a different one, and without any paging parameters it works fine. Once I add a /page/2/ on ...
0
votes
0answers
20 views

WordPress Rewrite Rule to EITHER Match 1 or 2 Taxonomies when adding to URL

I have a custom post type residential using a custom taxonomy residential_taxonomies and I am adding the taxonomy term(s) and the post type name to the url. It works fine if there are always a parent ...
0
votes
0answers
46 views

Rewrite post name / post title in the permalink

I have the following permalink structure: http://test.com/people/kids/joe-blogs/ I need to rewrite the post name (joe-bloggs) to a unique ID to protect the kids names - I have the following ...
1
vote
1answer
150 views

Add rewrite rule to call front-page.php?

I am trying to create a multilanguage website. And I have set my home page to a static page in my WP admin area. This home page ID is 2 and it calls front-page.php template when I am on the home page ...
0
votes
1answer
31 views

Is it possible to register a new template file?

I'm trying to create a custom user dashboard on the front end using a rewrite rule to /dashboard/ and a custom theme file dashboard.php. I notice that when loading in dashboard.php, I have to manually ...
0
votes
1answer
39 views

URL rewrite with external JSON query

I wrote a plugin that can fetch data from an external JSON source and displays a very few details in a list. Each item is clickable to be displayed with more details on a specific template. To do this,...
0
votes
0answers
15 views

Overcoming a complex WordPress page rewrite rules request

Desired URL structure: http://example.com/tips - page http://example.com/tips/post - CPT http://example.com/tips/category - custom taxonomy with hierarchy - parent http://example.com/tips/category/...