Questions tagged [url-rewriting]
Refers to the process whereby an URL is manipulated to create what in WordPress is called a "pretty permalink"
2,041
questions
0
votes
0
answers
24
views
Custom post type slug localization
I need to have 2 languages in a website (EN and LT).
I have a custom post type 'services'.
I need to have the links like this:
English version of the service: '/en/services/some-service'
Lithuanian (...
0
votes
0
answers
12
views
Implementation of a Download Wrapper
We have a number of static files (thousands) that are linked in WordPress from a post using Advanced Custom Fields and able to be downloaded. I am aware that this is insecure, but it is an inherited ...
0
votes
1
answer
22
views
Wordpress fallback rewrite
we have a situation where, for the same permalink, there could be both a page and a custom post, for example "car".
https://www.example.com/aaa/bbb/carPostID
Normally at that address there ...
0
votes
0
answers
15
views
Custom templates based custom url structure in wordpress
I'm working on a website that includes a section for Barbers, and I want to achieve the following URL structure:
Barbers {domain.com/barbers This page will have 2 section, 1 section will list Barber ...
0
votes
0
answers
26
views
get_query_var return false
I created a custom endpoint with add_rewrite_endpoint
function wp_en_endpoint(){
add_rewrite_endpoint('en', EP_ALL);
}
add_action('init', 'wp_en_endpoint' );
But when I use get_query_var( 'en' ), ...
0
votes
0
answers
28
views
Custom post permalinks for specific categories
I have specific categories posts where i want to remove category name from URL.
My current post link is: https://example.com/my_cat_name/post_name/
I want: https://example.com/post_name/
But only for ...
0
votes
1
answer
47
views
How to make 2 (or more) custom post type post pages sit under the same slug?
I've created 2 custom post types like so:
register_post_type(
'resources',
theme_build_post_args(
// $slug, $singular, $plural
'resources', 'Resource', 'Resources',
...
0
votes
0
answers
42
views
Is there a way to use rewrite rules in Wordpress to correctly render a page or post?
I made a Wordpress plugin that was able to rewrite URLs so that users could add a vanity segment at the end of the URL so that every page had personalized information via an external API call with the ...
0
votes
0
answers
7
views
Best way to approach creating a sitemap with unique URLS (No Permalink Changes)
I currently have been struggling mightily with a conundrum, I currently have a theme that is using day and name permalink settings so changing those settings are not possible, I'm attempting to make a ...
0
votes
0
answers
23
views
URL rewriting problem
He guys,
I would like to rewrite URLs like the following one:
https://my.domain/blog/2023/09/18/newsname
to the following
https://my.domain/newsname
So, category (and maybe even subcategory) and date ...
0
votes
0
answers
21
views
Pretty URLs for dynamically created product and pagination pages
I want to make a simple WordPress plugin that dynamically generates a paginated listing of elements of an array and product pages for each element. It examines if the current URL contains the query ...
0
votes
0
answers
24
views
Preserve the url for subpage
I have a units page
abc.com/units
When I visit
abc.com/units/toronto
this shows a 404 page.
I want to preserve the url /units/* and basically just redirect to units page while maintaining the url
So,...
0
votes
0
answers
25
views
Nesting add_rewrite_rule() with custom page and subcategories
The url structure looking for is :
blog/category/subcategory/
blog/category/post/
blog/category/subcategory/post/
My rewrite rules :
add_rewrite_rule(
'blog/([^/]+)/([^/]+)/?$',
'index.php?...
0
votes
0
answers
49
views
htaccess RewriteEngine On - Forbidden You don't have permission to access this resource
i made a staging site on subdomain on var/www/stagin
but when I want to access it I get; Forbidden You don't have permission to access this resource. in htaccess I have RewriteEngine On enabled, when ...
0
votes
0
answers
22
views
CPT Rewrite Slug to Another CPT Slug/Key (as CPT-A/CPT-B Format)
I registered multiple custom post types with following pattern:
CPT-A: 'has_archive'=> 'cpt-a' and 'rewrite'=> array('slug' => 'cpt-a', 'with_front'=> true)
CPT-B: 'has_archive'=> 'cpt-...
0
votes
1
answer
25
views
openlitespeed rewrite rules conversion from apache
# BEGIN Wordpress
<IfModule mod_rewrite.c>
RewriteEngine on
# behind proxy
RewriteCond %{HTTP:X-FORWARDED-PROTO} ^http$
RewriteRule (.*) https://%{HTTP_HOST}/$1 [R=301,L]
# plain
RewriteCond %{...
1
vote
0
answers
11
views
WordPress add_rewrite_rule not working with page_on_front
I am using the following code to rewrite "example.com?my_var=test" to "example.com/my_var/test":
function my_query_vars($vars)
{
$vars[] = 'my_var';
return $vars;
}
...
-1
votes
1
answer
232
views
Allow question marks (?) in WordPress permalinks
I have migrated an older site to WordPress and need to keep all legacy URLs. I am using a plugin called Custom Permalinks for that purpose, which works well, except for one thing: it strips all "...
0
votes
2
answers
21
views
rewrite for subpage seems to loose parameter
I have defined a rewrite rule for a subpage 'vehiculo' (which is a template-page in my theme folder), and subpage of 'vehiculos', because I want a pretty URL and the code is handled in the template ...
0
votes
0
answers
9
views
WordPress Custom rewrite does not work with seo url
I try to generate 3 custom rewrite rule, it does not really work very well.
Here is my plugin class file.
<?php
class QuestionAndAnswers
{
public $isUserLoggedIn;
public function ...
0
votes
1
answer
30
views
How to make a Custom Post Type entry to have different parent pages
I have a Custom Post Type "press-releases"
I want to be able to setup different parent pages for each entry from this CPT.
Example, I want to have something like:
website.com/parent-page/one-...
0
votes
1
answer
64
views
Allow requests to resources outside the wordpress folder
I have wordpress website https://example.com. /wordpress is never part of the url.
It runs on a dedicated server that runs Plesk Onyx.
The file structure is
|
- httpdocs
|
- wordpress
|
- ....
0
votes
1
answer
90
views
How to set product category base the same as shop base in WooCommerce?
I'm using WooCommerce on a WordPress. I would like my products and product categories to have the same url base.
E.g.
www.example.com/shop/product-category
www.example.com/shop/sample-product
Using ...
0
votes
0
answers
15
views
I need a permalink post_type structure with taxonomy slug in it for location landing pages and service pages
I am building a Wordpress site that has landing pages for locations in the UK. Each location needs sub pages to represent a service relevant to that location.
To do this, I have set up service pages ...
0
votes
1
answer
12
views
Blog URL Structure - Multiple Taxonomies
Does anyone know how, if it's possible, to include a base slug, two taxonomies and the blog title are the URL?
All posts would have either one or two categories.
e.g.
/blog/{category-one}/{category-...
0
votes
0
answers
16
views
My images aren't loading after adding update_option('upload_url_path', '')
I tried using update_option('upload_url_path', '/product_large') to change the url of my images. After updating the functions.php my images aren't loading in my site. Any possible solution? Thanks!
0
votes
0
answers
17
views
How to combine nearly identical custom rewrite rules for WordPress
I have 22 rewrite rules in my functions.php. I was wondering if it is possible to combine some of the nearly identical rewrite rules.
Combining identical rewrite rules for different PAGES:
'^videos/...
0
votes
1
answer
115
views
Add post id to url instead of WordPress default -2 suffix
I have a site where Posts in a Custom Post Type will have the same title. Per default WordPress will add a number after the url to handle this but I would like instead to always include the post id ...
0
votes
0
answers
149
views
Custom URLs between different post types, using "Pods"
Setup
I am using the plugin Pods, and I have created 2 custom post types: location and office.
The URLs to access these resources are, for example:
/location/new-york (for locations)
/office/my-ny-...
0
votes
1
answer
59
views
Multisite: Redirect a deleted site - Best practice?
I need to clean up the web server and delete a few deprecated child sites under my multisite install. What is the best practice for setting up a 301 redirect and deleting the old site?
0
votes
1
answer
31
views
wordpress category rewrite rule with pagination
with the help of someone here I was able to filter two or more categories via this rewrite rule
'^combine/([^/]*)/?([^/]*)/([^/]*)/?','index.php?category_name=$matches[1]+$matches[2]+$matches[3]', '...
-1
votes
1
answer
23
views
How to make my custom permalink pull up the correct post
I'm tryin to make short urls. Using base_convert, I can change site.com/10 to site.com/a
I'm currently using this...
function shortest_permalink_make_url( $url, $post, $leavename=false ) {
if ( $...
0
votes
2
answers
41
views
Wordpress picks a wrong template if ?cat= is used as URL parameter
I have a website with the following article structure. This works and uses archive.php template like it's supposed to
website.com/category/articles/arrester/?tag=online-lectures
This also works and ...
0
votes
1
answer
142
views
How to change url of posts?
I want to show my posts url like "domain.in/blogs/blogname" . for only the posts not for the pages. how can i make it like that
0
votes
0
answers
17
views
"-2" Postfix added at the end of the permalink [duplicate]
I know -2 comes due to having duplicate names either in post/pages or media files.
But I don't have any such duplicate name. In fact, I tried installing WordPress from scratch and tried to create a ...
0
votes
0
answers
42
views
WP-Include rewrite directory
I try few day to rewrite wp-include directory but not success.
In .htaccess I add next line
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^main/(.+) /wp-includes/$1 [L,...
0
votes
0
answers
21
views
add_rewrite_rule doesn't work when trying to add a new parameter at the end of URL
I wish to add a userq parameter at the end of a URL with the username such as john. I wish to change,
example.com/user/john
to,
example.com/user/index.php?userq=john
I tried this and this and they ...
0
votes
1
answer
69
views
Change url site.it/wordpress
I need to change the URL of an existing website from www.site.it/wordpress to www.site.it. I searched on the Internet and followed the following steps:
I downloaded the index.php and .htaccess files;
...
1
vote
1
answer
782
views
Custom rewrite, url path with parameters to a page
I'm developing a plugin, that should display content according to two optional parameters in the URL. The following URL should all be treated by the plugin:
/pluginpage/
/pluginpage/value1/
/...
0
votes
0
answers
32
views
How to add page category slug to base url
I use register_taxonomy_for_object_type( 'category', 'page' ); to add a taxonomy to the Page, but the url doesn't show the page's category slug.
So is there any way to display the slug of the current ...
0
votes
0
answers
40
views
Allow child pages with the same base as the CPT slug
I use WordPress, but I don't use the archive templates, nor the default post. Instead, I create a CPT that will function as my blog, and I use regular pages for archives. This gives me a minor ...
0
votes
0
answers
25
views
Post pages are redirecting to the 404 page in wordpress
In my root folder, I have installed WordPress. Now I have created a resources folder in the root and installed WordPress in that too.
I am able to login into the resources admin panel and created ...
0
votes
1
answer
69
views
Problems Implementing Non-WordPress Rewrite Rules
A colleague and I are working on a custom theme and one of the things we need to do is push a specific custom URL type (/team/ for example) into the backend of our website(/wp-content/themes/...
0
votes
2
answers
104
views
Create a page for each database table entries
I am creating a job board website(it is a part of the website). I have a JobOffer class with some rows in the database(added with it's form...). My problem now is to have a page for each of these ...
0
votes
0
answers
101
views
Standard Regex syntax doesn't work in WordPress rewrite rule
I've run into a regex issue while adding a rewrite rule into a Wordpress plugin. This blog has been helpful and the redirect works correctly after following this: https://brightminded.com/blog/...
0
votes
0
answers
24
views
WordPress is adding pagination for all pages like www.example.com/page/123. How to remove that?
I think WordPress is adding pagination for all pages like www.example.com/page/1234.
In my case, it is adding for all pages not only for the blog page.
How to remove the pagination for pages in ...
0
votes
0
answers
30
views
How can I add_rewrite_rule for a custom post type to preserve the referral id
I've got this url /referral/{referralId} which needs to redirect to {customPostType}/{customPostSlug}/{referralId} and I'm really struggling to figure out how to do this with wordpress's ...
0
votes
1
answer
262
views
How to disable WordPress canonical redirect to nearest matching URL and force 404 Page?
WordPress appears to rewrite URLs, displaying Pages under the incorrect URL.
Example. I have a page called "Emotion" with the slug /emotion/
On the front-end it should appear as the ...
0
votes
1
answer
201
views
Custom slugs with dates & IDs on Custom Post Type
Trying to do something with the rewrite argument on custom post types.
I'm after 2 different things here for 2 different custom post types.
1: Slugs which look like this
post-name-year-month-day
So ...
0
votes
0
answers
29
views
Multiple permalinks for a single post from custom field
I'm looking for a way to add additional slugs for regular posts, so that a single post can be viewed from multiple urls.
Example: the canonical post url would be: website.com/foo-bar but I want ...