Stack Exchange Network

Stack Exchange network consists of 174 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
Join us in building a kind, collaborative learning community via our updated Code of Conduct.

The mod_rewrite module uses a rule-based rewriting engine, based on a PCRE regular-expression parser, to rewrite requested URLs on the fly. By default, mod_rewrite maps a URL to a filesystem path. However, it can also be used to redirect one URL to another URL, or to invoke an internal proxy fetch.

2
votes
3answers
46 views

htaccess rewrite for author query string when WP is in subfolder

I have successfully forbidden access to any kind of author pages whether trough /author/username/ or the ?author={#id} query string. I did this with this added to the beginning of my htaccess file: &...
1
vote
1answer
81 views

How To Fix A Redirect Chain

I hope someone might be able to help with this. My site crawl is showing that I have a redirect chain on my home page. Basically it shows I am going from : http: > https: > https://www. I need ...
0
votes
1answer
49 views

.htaccess rewriterule being ignored - tyring to remove dates from WP posts

Should be a fairly simple procedure. I've done a fair share of internet searching and can't get the htaccess rewrite to work in /public_html Using a VPS Apache server, any idea's why? Thank you in ...
1
vote
2answers
25 views

mod_rewrite empties QUERY_STRING if starting with number [closed]

I have a simple database query script alongside with my WordPress installation, to which I pass a parameter using the following URL: http://example.com/db/?p=foo. My database script reads the ...
1
vote
0answers
68 views

How to rewrite wordpress urls with index.php in them

I want to make custom WordPress URLs like this : http://example.com/index.php?productID=123 and for categories http://example.com/index.php?categoryID=123 and the reason is we have a website written ...
4
votes
2answers
166 views

Remove year and month in URL using .htaccess

For example, to redirect old URLs of the form: /2016/10/mukunda-murari-kannada-songs-download.html To /mukunda-murari-kannada-songs-download.html I have already changed the permalink structure in ...
0
votes
0answers
257 views

using htaccess to check for cookie on permalink then conditionall rewrite with query parameter

On a wordpress site(also looking for multisite solution), looking for .htaccess to check for cookie being set, then if cookie is found add a parameter to the permalink. It works for top level, but any ...
3
votes
1answer
393 views

Wordpress on a subdirectory of Laravel - Wordpress pretty permalinks inner page shows laravel

I read lots of discussions about this and found no solution. I have a Laravel web app and added a Wordpress site in a subdirectory. This is what my .htaccess looks like within the public folder: <...
0
votes
0answers
69 views

Rewrite Rule Confusion – How to inspect / debug?

I find it very hard to debug rewrite rules in wordpress. I am working on a way to go from http://example.com/some-podcast-slug/time/21:21s to http://example.com/some-podcast-slug/?t=21:22 – usually I ...
1
vote
0answers
96 views

Rewrite Rules and Login Issue

I have rewritten the rules in the .htaccess file of my root domain and now it shows exactly the same content as my subdirectory. Important: it is not been redirected to it. 2 seperate sites with ...
0
votes
0answers
32 views

htaccess question and plugins.php

Does anyone know what this is doing: RewriteRule ^admin/(.*)?$ admin/index.php?a=$1 [QSA,NC,L] I'm having a problem accessing /wp-admin/plugins.php and I'm not sure if it's caused by the RewriteRule ...
1
vote
0answers
24 views

Custom Rewrite rule to captured post (rewrite rule to rewrite rule)

I couldn't come up with a better question-title; Sorry! The example will clarify things quickly. My rule: add_rewrite_rule("^podcast/(.*)/time/([\d|\:]+)", "/podcast/$1/?time=$2", "top"); In words: ...
1
vote
1answer
98 views

Taxonomy Pagination Rewrite

I have a custom post type named "testimonials" with a slug of reviews. I also have a taxonomy named "testimonial-department" with a slug of reviews. The goal being I will have pretty permalinks such ...
1
vote
1answer
197 views

Cache Busting using htaccess Rewrite rule?

I am trying to follow this tutorial that says i can make a server to send a file like style.css if the requested file is style.15458888.css with a rewrite rule to be put inside the htaccess file. ...
1
vote
1answer
327 views

How to create a redirect in the .htaccess file, with 2 exceptions

So I've been trying this for a long time, but I can't seem to get it to work. Pretend my website is https://example.com, with the additional pages https://example.com/abc and https://example.com/abc-...
1
vote
1answer
344 views

Mod_rewrite delete parameter in 301 Redirect

How would I go about rewriting: http://www.example.com/?aff=number to: http://www.example.com I want to remove all instances on aff=x regardless of how many other parameters in the URL.
3
votes
1answer
1k views

Place static HTML files in path below WordPress page

I have a WordPress instance running on my domain's root. One WordPress page is located at www.example.com/product/. I placed some static HTML files in a path below that so that visitors can go to www....
0
votes
1answer
173 views

Rewrite rule and display of post

I'm trying to create a permalink for single posts that are in a particular category called 'Test'. So I've set the stub with a filter which in turn sets the permalink when the post is saved. At the ...
0
votes
0answers
130 views

Multisite: use of subdomains in directory structure conflicts with site on subdomain

I'm currently developing a website for the company I work for and we have recently moved to a multisite configuration as the department responsible for getting the projects to us (developers) suddenly ...
0
votes
1answer
138 views

Cannot get 301 redirection in htaccess to work (either Redirect or Rewrite)

I have recently changed how posts are categorized and changed the permalinks not to show the category. Consequently, I need to redirect the old URLs. I have tried many variations of the following but ...
0
votes
1answer
91 views

force www rewrite if wordpress put in a folder

My wordspress site is installed in myfolder and it auto create the code in htaccess # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase /myfolder/ RewriteRule ^index\.php$ - ...
1
vote
0answers
72 views

Image URLs not redirecting properly

I recently migrated my site from http to https. I have set up 301 redirects using htaccess. Everything works fine except the image url. The indexed images in Google has the old urls. when I click the ...
0
votes
1answer
33 views

What is the best practice workflow for new website overhaul and keeping current SEO ranking? [closed]

I have a WordPress site that is doing well with SEO and but the theme is quite antiquated and will be completely overhauled with a new custom theme, updated plugins and new functionality. I am ...
0
votes
0answers
26 views

Template hierarchy changes when custom post-type permalink leverages custom taxonomy

I've got a custom post type departments with a custom taxonomy department and am using Custom Post Type Permalinks plugin. In the CPT, I define the permalink like this: 'rewrite' => array( 'slug'...
1
vote
0answers
136 views

404 error Additionally 403 Forbidden error on a URL

On my WordPress website i got a error on www.example.com/blog url only as the screenshot. I already check- Files + Directory permission, everything is right. Code on .htaccess, just WP default code ...
1
vote
0answers
14 views

Map secondary domain to other's virtual subfolder

I'm working on a Wordpress site and there's a request to map otherdomain.com to maindomain.com/virtualsubfolder/ (the WP site). This can be easily done, but the URL structure should remain intact i.e. ...
1
vote
1answer
404 views

Can only access homepage and admin panel

I am really struggling to move Wordpress from an external host to my localhost (xampp). After two days trying to do this I am now at the stage where I can access the homepage and admin panel, but ...
0
votes
0answers
24 views

NGINX: Remove WordPress subdirectory from url [duplicate]

I have installed WordPress core in a subdirectory as I am using composer. The root is /www/example.com/ and WordPress is placed in /www/example.com/wp/ In the root is index.php and wp-config.php. ...
1
vote
0answers
57 views

Mod_Rewrite to show only last subcategory in URL

I have a website with a three-tier hierarchy of categories: Main category> Subcategory> Second Level Subcategory. In the URL I would like to get only the currently selected category displayed. ...
5
votes
0answers
457 views

Hosting a Wordpress blog as a sub folder from a S3 website

I have a website set up for my organisation under www.mycompany.com (running on Amazon S3). I also have a Wordpress blog set up under blog.mycompany.com (running on a separate LAMP server). For SEO ...
1
vote
1answer
925 views

Custom rewrite rule, url returning 404

I have a custom URL like this: website.com/show/?id=9999&n=page-name and I'm trying to come up with a mod_rewrite rule to convert to website.com/show/9999/page-name/ /show/ is a page name. ...
1
vote
1answer
1k views

Pretty urls for custom pagination

I have custom query with custom pagination with which I'd like to use pretty urls, like the standard pagination, rather than appending a query string to the url, ie www.example.com/posttype/pagename/...
0
votes
1answer
409 views

Deny access to uploads folder with exceptions

On a members only site logged in members can access the files in the uploads folder, if not logged in they are redirected to the login screen. I'm using the following in the .htaccess file to do that: ...
1
vote
0answers
166 views

How to remove the [L] Flag for Wordpress index .php mod_rewrite

I have been having difficulties with redirecting query strings for the new WordPress site we launched. I am using mod_rewrites to do the redirect and I can get them to work by removing the [L] flag ...
0
votes
1answer
996 views

Remove base slug in permalinks of hierarchical custom post type

I have a hierarchical Custom Post Type called project, registered as follows: register_post_type( 'project', array( 'public' => true, 'hierarchical' => true, ...
0
votes
1answer
70 views

WordPress rewrite does not work for some reason

I am learning how to use WordPress rewrites. As a start i am just trying to redirect any request for "validate_data.php" to "validate-data". Here is what i have added to the functions.php file: ...
3
votes
0answers
282 views

WordPress URL/Folder ReWrite using Htaccess

I am trying to mask certain folder in a WordPress installation using the Htaccess file. I am aware that there are plugins available to do exactly what I want but, I do not want to add even more ...
3
votes
1answer
173 views

Bypass .htaccess when using download_url

I've got the following .htaccess file in my a custom directory in Uploads called client. RewriteEngine On RewriteCond %{HTTP_REFERER} !(www.)?example.co.uk/client-area* RewriteRule ^.*$ - [R=403,L] ...
0
votes
0answers
57 views

.htaccess rewrite into Wordpress not hiding URL

Lets say I want to rewrite URLs from one subdirectory to another (my actual use case is a bit more complicated but this is a simpler example): <IfModule mod_rewrite.c> RewriteEngine on ...
1
vote
1answer
60 views

Server Move: All pages leading home

The Problem. No matter which URL I enter, all pages display the site's static front page. Known site URLs load the home page (but keep the URL entered) and should-be 404 paths like /I-know-you-do-not-...
0
votes
2answers
3k views

disable Wordpress 404 for one specific page/folder to receive actual php errors

I have a Wordpress based site with an additional custom PHP application with files in it's own folders - "staff", "volunteers" etc. We have mod-rewrite in .htaccess file so we can use permalinks # ...
1
vote
0answers
442 views

Changing wp login url without plugin

How to change my word press admin url link in my site? RewriteEngine on RewriteRule ^dashboard(.*)$ wp-admin$1 [L,NC]
0
votes
1answer
103 views

Hide category name using mod_rewrite

I have a website with at least 3 categories. I have set one of them as the default category. Next step was that I need to have the category slug of the default category to be hidden from the URL slug,...
0
votes
2answers
323 views

add_rewrite_rule() driving me crazy, rewrite not working when analyzer says it should

I have a special situation and need some help achieving the final step. Background: When I access mydomain.com/category/postname, I get the post as expected. When I access mydomain.com/category/...
0
votes
1answer
200 views

Add additional non-rewrite .htaccess directives on multisites via mod_rewrite_rules filter

According to the example on Adding your own .htaccess contents via WordPress it's possible to extend the .htaccess file via theme/plugin. for example: <?php function my_htaccess_contents( $rules ) ...
0
votes
2answers
573 views

.htaccess Non-'www' to 'www' Subdomain Redirection Only Works for Homepage

I would like a WordPress site to redirect all URLs to the www subdomain. Using the .htaccess configuration below, the homepage is properly redirected (i.e. visiting example.com/ redirects to www....
0
votes
1answer
17 views

Permalinks not working in Wordpress

In wordpress I've chosen "Day and name" for permanlinks but I am getting 404. The modrewrite module is loaded, the .htaccess is -rwxrwxrwx 1 www-data www-data 274 nov. 23 13:10 .htaccess i have ...
0
votes
2answers
827 views

Rewrite rule not working

I have a page on my wordpresss with url /sca. I want all traffic from /sca/project_0 to direct to /sca?urn=project_0. I added a rule to my .htaccess file but it is not working. I don't think this a ...
0
votes
0answers
281 views

How to change permalink structure and keep permalinks for old posts

I'm migrating to WP from blogger and my old permalinks have the structure: /year/month/postname.html In wp for my future posts on I would like to use the /postname.html custom structure. I don't ...
0
votes
1answer
1k views

htaccess and redirect to new url using regex

I have a hard time to create rewrite rule for a redirect using part of an old URL for WP. Example: Old URL: http://www.example.com/news/index.php/2014/11/07/my-blog-post-from-old-site or http://...