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
15 views

Breaking a post into multiple subpages, each with a custom slug

I'm trying to break a single page into multiple subpages. Started out using <!--newpage--> html comments, but then decided to switch to a customized version of the multipage plugin. The basic ...
0
votes
1answer
22 views

Add slug to default post permalinks ONLY

I've been browsing and reading and testing and can't seem to find a clean solution for my problem. A solution that doesn't affect all other post types, categories, custom taxonomies, etc. :( Is there ...
0
votes
0answers
14 views

Change custom rewrite rule when permalink is updated/changed

I have a scenario where i need to make a rewrite rule dynamic so that when permalink is changed the re-write rule should get updated as well function rewrite_rule() { global $wp_rewrite; $...
0
votes
1answer
37 views

Rewrite rules in multisite

I've been trying to set up different rewrite rules on my multisite installation, but as of now, nothing is working. Even the simple add_rewrite_rule('^welcome$', 'index.php?p=1', 'top'); isn't ...
2
votes
1answer
22 views

Why specific file directory fails to redirect but its parent folder succeeds?

I activated multisite using subdirectories on my old WordPress site, and I created a new site (say my-example.com/new-site/). I found links such as my-example.com/new-site/wp-content/mu-plugins/css/ ...
1
vote
1answer
28 views

Remove custom post type slug not working for child pages

I'd like my custom post type, products, to not use a slug, eg: domain.com/product-name. The code below sorts that out nicely, however it fails to work with child pages, eg: domain.com/product-name/...
0
votes
0answers
38 views

Complicated rewrite rules and content with custim fields and CPT

I have page (post type page) called Pruvodce (slug = pruvodce). I have subpages (many) (e.g. egypt). So new url for egypt is domain.com/pruvodce/egypt/. What I need is to create virtual pages (tabs) ...
0
votes
1answer
47 views

add_rewrite_rule only works when flush first

I have the following code in my functions.php file. I have a page projects. I have two custom post types: project and projecttype. An individual project post has it's own permalink /projects/project-...
0
votes
1answer
29 views

add_rewrite_rule wordpress ignoring url pattern, wp rewrite not working

I want to want to make url friendly urls for a custom function I am using in my website. I have added a custom template on my theme dir. The url rewrite function that looks like this: function ...
0
votes
1answer
12 views

How to fix 404 on post after prepending Custom Post Type url with Custom Taxonomy Term slug

I'm setting up "special" url structure for posts etc Result i want to get is: sitename.com/club/justcavali club is term from taxonomy (club_type) and justcavali is post type (booking_type) after i ...
1
vote
1answer
18 views

How do I flush rewrite rules

How can I flush rewrite rules after saving or updating any page? Pretty much a newbie and trying to figure out how this would work. add_action( 'save_post', 'my_save_post_function', 10, 3 ); function ...
0
votes
0answers
12 views

How to Select post parent for CPT from another post type?

I'm developing a Sports website, covering cricket football, etc. The goal is: .pk /cricket (Landing page) .pk /cricket/ipl (IPL Landing Page) .pk /cricket/ipl/year (IPL Landing Page by ...
0
votes
0answers
14 views

Homepage rewrite rule

I'm trying to display a product tag archive page (WooCommerce) as my basic-main-root domain (mydomain.com). It can be done with the 'shop' page (via WordPress front-page settings) - which is the same ...
2
votes
2answers
41 views

Add Rewrite Rule to point to a file on the server

I'm trying to add a rewrite rule that will point to a file inside a plugin. This can be added in the plugin, theme or .htaccess file. My current code from inside the theme's function.php looks like: ...
0
votes
1answer
37 views

Rewriting url for multiple Taxonomies and Custom Post Type

I have 2 taxonomies ( genre and artist ) and Custom Post Type ( Lyric ) the url structure i want to get is CPT: /lyrics/ - archive page for CPT Artist: /lyrics/artist/ & /lyrics/artist/song-...
1
vote
0answers
33 views

Custom rewrite rule sends 404 header on multisite

I have a custom rewrite rule which rewrites /wp-content/themes/my-theme/manifest.json to /index.php?manifest=true. This generates some JSON code for progressive web app functionality, and generally ...
1
vote
2answers
26 views

Should the actual /category/ directory be 404? Is that normal WP behaviour

I'm not sure if this is 'normal' but on my WP install the actual directory for 'category' throws a 404 error. So, for example, if I had a category called 'apples' then every post or page associated ...
3
votes
1answer
45 views

Taxonomy rewrite question

I have custom post types for dining, lodging, and activities. Each of those custom post types uses a custom taxonomy called region. If, for example, I have a region called "downtown", I would like to ...
2
votes
1answer
53 views

Having trouble with using add_rewrite_rule and pagination

We have a section on the site, such as: www.example.com/for-sale/category-name/ for-sale is a WP page, however category-name is dynamic and is what I wrote the below rewrite rule for. ...
0
votes
0answers
54 views

Custom Post Type parent/child relationship rewrite rules for permalinks

I have been working on this for quite awhile but I'm stuck at rewriting the permalinks for both the parent and the child. So I created two custom post types: magazines and magazine-pages both MUST be ...
0
votes
1answer
53 views

Custom rewrite after the default term link URL

I have a taxonomy car and a couple terms like kia, honda, and toyota. Using the function get_term_link(), I can get a term archive link like this: site.com/car/honda/ I am trying to use custom ...
0
votes
0answers
17 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
15 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
46 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 ...
2
votes
1answer
30 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
23 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
28 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
27 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
17 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
37 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
41 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
15 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
25 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
40 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
85 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
39 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
42 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
55 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
36 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
112 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
58 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
117 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
51 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
45 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
39 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
136 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 ...