Questions tagged [url-rewriting]
Refers to the process whereby an URL is manipulated to create what in WordPress is called a "pretty permalink"
1,995
questions
0
votes
0
answers
10
views
Adding /blog in front of single posts (only)
I would like to add /blog in front of the url for a single post:
e.g.
website.com/blog/news-article -> single article
website.com/blog -> blog archive (showing a list of all blogs etc.)
Ive ...
0
votes
1
answer
9
views
How do I add a tag slug to a category URL to filter posts?
I want to add an option to my site to filter posts by one specific tag on the category page and at the same time have a nice URL (no query strings).
So something like this:
https://example.com/%...
0
votes
1
answer
17
views
Add static text to post URLs
I have 2 pages on my site which include blog posts (real site is pw protected):
https://example.com/blog/
https://example.com/news/
All blog and news articles should have a URL that begins with https:/...
0
votes
1
answer
33
views
Setting Parent Page to Post
Does anyone know how to achieve different parent pages for posts?
I've managed to code a Custom Post Type that sits under a specific parent page, but I want the option to change this from post to post....
0
votes
0
answers
19
views
WordPress how to prevent URL encoding in URL of taxonomy terms
Is it possible to prevent WordPress from encoding URL with terms? I have a sample taxonomy term "iPhone5~iPhone7" and when I use it for the search function, it turns to "iphone5%ef%bd%...
0
votes
0
answers
20
views
How to rewrite URL back to default custom URL if no destination found
My current situation is:
I'm redirecting the custom category request to below kind of url:
http://my_url/news/category/abc
I've managed to add my custom query var category and can get the query var ...
0
votes
1
answer
48
views
How to pass username in affiliate link in wordpress website
I need to pass current logged in user in wordpress website as SUBID in the affiliate link as follows.
Affiliate link format is like below.
https://affiliatenetwork.com/track?id=myuserid&url=https:/...
0
votes
1
answer
22
views
How to set add_query_arg properly for home page?
I want to add lang query variable to existing URL.
I have registered query variable:
add_filter('query_vars', 'custom_add_query_vars');
function custom_add_query_vars($vars){
$vars[] = "lang&...
0
votes
0
answers
21
views
Show index.php template instead of 404 page template
I have some posts that were permanently deleted, however, instead of wordpress returning the 404.php page template, it is returning the index.php template. In other posts, the behavior is right, but ...
0
votes
0
answers
20
views
Add rewrite rule for custom post type single page
I am new in the WordPress and I do not know how to convert query parameter as URL for custom post type single page. I do not want to change any affect result of single.php.
Just want to convert below ...
0
votes
1
answer
33
views
Rewrite parameters as Url for SEO
I have urls of this form:
example.com/event/?eventId=1
example.com/event/?eventId=2
The problem is Google is indexing only example.com/event, which is a blank page. It's not able to display an event ...
0
votes
0
answers
12
views
Create Custom URL structure for specific Post category using Post ID instead of post name
My Custom Structure is set to "%postname%/"
This works as expected, but for Posts with the Category "Latest News", I would like to change the URL structure to be "%postid%/&...
0
votes
0
answers
12
views
loading images, css and fonts from site url
I changed the site url to example.com/blog but the wordress url is blog.example.com, still css, images and fonts are loading from blog.example.com, is there any way to force wordpress to load files ...
0
votes
0
answers
43
views
Custom taxonomy terms as children of multiple custom post types
I'm about to start a part of my project that I've been putting off for too long. I'm not looking for code, I'm looking for confirmation that I'm on the right track and any advice Stackexchange may ...
0
votes
0
answers
13
views
Remove cpt slug from url and use custom taxonomy instead breaks all other cpt
Im trying to do so, it works but also affects all other cpt (404 for all cpt but not resources one)
this is what I have
In the cpt definition
...
'rewrite' => array(
'...
0
votes
0
answers
13
views
Home page url rewriting Wordpress
0
I want to do a URL rewrite in the WordPress home page
I want to change my URL http://mysite.loc/?pays=senegal to look like http://mysite.loc/senegal.
The problem is that I am on the WordPress home ...
0
votes
0
answers
12
views
Weird urls after moving site from local env to a server
I've noticed after moving website to a server post slugs started looking something like 78a6a04c0d498postname78a6a04c0d498.
0
votes
0
answers
10
views
Changing the wordpress default search url to something like - ...example.com/search?query=keyword
So I was trying to customize the WordPress default search URL and I found several solutions describing how to add a custom slug to the WordPress search URL and turn them into something like ...example....
0
votes
0
answers
10
views
Remove tag base and category base while still keeping the rewrite rules
In order to have a URL structure with both category and tag combined (xyz.com/category/soccer/without-laces/tag/adidas
) I use the following rewrite rule in functions.php:
function ...
1
vote
0
answers
26
views
Serve specific "template" page at any URL that ends in its slug
Still new to WordPress, so please go easy on me.
Goal:
Prevent users of a specific role from viewing other custom post types made by users of same role.
Intended solution:
Modify the URL and redirect ...
1
vote
0
answers
10
views
How to add a custom redirect rule for Post as subdomains?
I am trying to write a custom redirect rule to open a download matching pages.
Example: postname.example.com/download
Example2: postname.es.example.com/download
I am using the following code in my ...
1
vote
2
answers
34
views
Append a query string to the end of every URL
I'm trying to append a query string to the end of every URL for logged in users for cache busting purposes. Here is the code I have but it doesn't seem to work. Any ideas?
function add_admin_qs($url){
...
0
votes
0
answers
11
views
Add separate list of pages under Admin
I am working on a university website and as per their sitemap structure, I have to use pages>subpages only. But under some pages, there are hundreds of sub pages so it becomes complex to maintain ...
0
votes
0
answers
8
views
remove url from categories
I was wondering how to remove the url from the categories?
or perhaps make it so that at that specific url page could be shown.
So, let me explain the issue;
I have a website with 6 categories, but i ...
0
votes
1
answer
37
views
post_type_link Filter - Too Few Arguments
I am building a website for a client with an existing website and I need to set the URLs to be exactly like they are in his old website.
I have created a custom post type with a custom taxonomy for ...
1
vote
1
answer
15
views
How to rewrite the custom url in wordpress?
I have tried to rewrite the url from
http://example.com/club/?state=AL
to
http://example.com/club/AL
Added query vars and rewrite url in functions.php
add_filter('query_vars', 'my_query_vars', 10, 1);
...
0
votes
0
answers
17
views
Remove subcategory slug from url
My posts are sorted by categories and subcategories
Their urls look like this :
https://one-domain.com/blog/
https://one-domain.com/blog/news/
https://one-domain.com/blog/news/video-games/
https://...
0
votes
0
answers
48
views
issue with wordpress [wp-admin] redirects, when using kubernetes ingress hosting two wordpress websites using path
i'm trying to setup a kubernetes deployment for two wordpress websites in different pods, each will have it's own deployment and service, etc..., under the same ingress, i have setup the ingress this ...
0
votes
1
answer
38
views
URL rewriting in wordpress using parameters
This seems like a fairly simple idea, and forgive me for my ignorance, but in searching and testing various options, none of them work at all. I have tried a number of htaccess ideas and also ...
0
votes
0
answers
21
views
Creating an alternate path for a page
I would like to load the same page under a different URL, but not via a redirect.
For example, suppose I create some page with id=6 - I can access this page via example.com/index.php?page_id=6 - if Im ...
0
votes
0
answers
18
views
add_rewrite_rule refuses to function
I am trying to create a custom redirect on my local machine using MAMP. From the Wordpress codex I have the following code as a simple starting point. No matter what I try I cannot get this simple ...
0
votes
0
answers
23
views
Using custom structure prefix showing 404 for sub-categories
I'm trying to nest my posts (post type: posts) under sub-categories.
The structure I'm trying to achieve is:
/knowledge-base/category/sub-category/postname
And this is how my permalink is look like:
/...
0
votes
1
answer
93
views
Is it possible to create dynamic endpoint URLs?
I want to create an archive endpoint page that will have a dynamic slug, based on the taxonomy term slug.
e.g. If the taxonomy is Food and the current term is Onion, I want the endpoint slug to look ...
0
votes
0
answers
37
views
Query vars to return the homepage
I would like to rewrite a path like example.com/foo to the "front" page (example.com).
So when I request example.com/foo the content shown should be that of example.com. Note, a redirect is ...
0
votes
0
answers
57
views
Adding the amp url prefix to the beginning
I created my own AMP template with this and the URL prefix became 'amp'
<?php
define( 'AMP_QUERY_VAR', apply_filters( 'amp_query_var', 'amp' ) );
add_rewrite_endpoint( AMP_QUERY_VAR, EP_PERMALINK );...
0
votes
1
answer
29
views
Postname on unique permalink structure appends "-2" for a custom post type. How can I get this to stop happening?
I have a custom post type "events" that has rewrites / permalink modification in place so that it includes the year and month in the URL (these come from ACF fields). This works perfectly ...
0
votes
0
answers
20
views
Change language on website and change currency with url query
I got plugins that change language automatically, such as loco translate and Gtranslate. I need help when the user changes language also the currency
if someone chooses the Spanish language then the ...
0
votes
1
answer
28
views
Redirect to new domain that serves new and different content
What I want to do:
Redirect old domain to new domain
Redirect all urls of old domain to new domain's home page (Old and New site serves different contents)
What I've done:
301 redirect old domain ...
1
vote
1
answer
134
views
Adding rewrite rule dynamically
I'm trying to dynamically add a rewrite rule that allows one to access any page under an alternate permalink structure of my choosing.
So for example, if the alternate permalink structure includes the ...
0
votes
0
answers
17
views
Rewrite rules - page does not exist
I've made a website for a client for a driver school, and we need to use special plugins connected to a company that handles the database.
So from the website, we connect to their database, and load ...
0
votes
1
answer
35
views
dynamic URL rewrite
I want to rewrite the dynamic URL https://example.page/detail-view/?mediaId=2316 and get the SEO-frendly URL https://example.page/detail-view/2316 instead. How can I achieve that?
Thank you in advance....
0
votes
0
answers
17
views
corrupted URLs - can't leave starting page
I have a big problem with my WP installation:
An access to my pages is (no longer) possible via (public) URL. All calls that originally worked end up on the home page. Also, visitors can't get away ...
0
votes
0
answers
46
views
Wordpress rewrite front page url
I am trying to implement a language prefix to my Wordpress. I now have working Rewrite rules for %lang% tag, query_var etc. Everything works ok, except for front page.
What I am trying to do: allow ...
0
votes
1
answer
65
views
Custom Permalink For Custom Post Type - Working Fine But Broken For Pagination
I'm having an issue with pagination not working while trying to get custom post type permalink. I've Custom post type 'songs' and custom taxonomy 'singer' here:
example.com/songs/ // ...
0
votes
0
answers
17
views
Add custom categories and subcategories and posts as custom pages
I have to add car info section to existing website and since I need to add lots of engine types I will do it with script (this is done).
I need to represent the structure Brand > Model > Year &...
0
votes
0
answers
27
views
Add NUMBER in WordPress URL
My URL Currently is sitename.com/jobs/job-name/
I have a custom field in backend, named as reference number (reference number is a number; i.e. 1234 or 2345 or anything in number)
So i want we ...
0
votes
1
answer
25
views
Use URI suffix as parameter and ignore when resolving page
I'm trying to change the output of pages depending on the URIs last section. This will be used to enable the user to change the page's presentation by changing the URL (e.g. /path/to/page/xml would ...
0
votes
0
answers
14
views
Rewrite rules for sub category (child product categry & grand-child)
I am lack in rewrite rules.
Now I success to rewrite product category parents, but how I rewrite to call child product-category and also for grand-child
domain.com/{parent-productCat}/ => success
...
0
votes
0
answers
21
views
Rewrite the search page to use an appended slug + parameter
I have two URLs that handle search
~/search/ = main search page
~/?s= = results page
What I want: to have one search page where the search parameter for the results page appends to the search page ...
1
vote
1
answer
395
views
Change htaccess to redirect to index.php in subfolder
How can I change the WordPress root folder .htaccess file to redirect URLs with a specific subfolder to its own index.php and give the path data as a URL variable to the index.php?
https://example.com/...