Apache Web Server
--
Questions
--
Followers
Top Experts
I am restructuring a client site and I have this:
New: http://www.brookline.com/living-in-brookline-ma/shopping/shopping-at-chestnut-hill/
Old: http://www.brookline.com/shopping/shopping-at-chestnut-hill/
So for all shopping we add:
- living-in-brookline
- shopping
Is there an easy way to match a Rewrite rule to fix all these sections for I dont have to go through each one?
Thanks,
Ryan
Zero AI Policy
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
https://www.experts-exchange.com/questions/27752325/WordPress-301-wildcard-pages-and-sub-pages.html
I searched on google for various fixes and nothing really fit what I needed. The custom permalink plugin worked great on my single pages though!
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /brookline/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /brookline/index.php [L]
</IfModule>






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.
RewriteRule ^(.*)/(.*)$ /brookline/$1/living-in-br
But it wont load any assets, its adding in living-in-brookline-ma to every URL, thoughts?
i was thinking if it had that living-in-brookline-ma in the tag it would match the rest or the rule above matches ALL cases?
i would have this too:
RewriteRule ^(.*)/(.*)$ /brookline/$1/neighborhood
RewriteRule ^(.*)/(.*)$ /brookline/$1/living-in-br
etc
Thanks, I think its close!
Ryan
RewriteRule ^visitors-center/the-arts/
Now a slight catch, when i have Custom Permalinks activated, my rules in my .htaccess wont work? Any thoughts on how to make them play nice?
If you read my note above it doesnt play well with that rewrite above.
Do you know if I can make a custom permalink without the plugin for specific pages?
Ryan

Get a FREE t-shirt when you ask your first question.
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
user enters URL
WordPress .htaccess translates URL to ID number, fetches page
Custom Permalinks fires, adds new 301 redirect via header()
Browser displays content with Custom Permalinks header
Again, purely speculation as I would have to download the plugin and deconstruct it.
So I wonder what is the best way to still use that plugin and do the rewrite above?
Ryan
wp_redirect( get_home_url()."/".$url, 301 );
So this is definitely activating after the .htaccess file is processed.
This plugin is only useful for assigning custom permalinks for individual posts, pages, tags or categories. It will not apply whole permalink structures, or automatically apply a category's custom permalink to the posts within that category.
The plugin probably isn't intended to work in conjunction with manual rewrites because it fires after that. ย So either you specify the redirects in .htaccess or in the plugin but not both.
It's worth noting that if you can write regular expressions and the links to be redirected fit any sort of pattern, then you can handle this in .htaccess without the need for the plugin.
Do you know if I can make a custom permalink without the plugin for specific pages?
Not easily. ย You would probably have to switch to custom taxonomies to get the different slugs you desire.






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.
See this image: http://cl.ly/163E460C1w3i3w322o2wย - would something like that work with:
RewriteRule ^shopping/[A-Za-z]/$ /living-in-brookline-ma/sh
I tried some variations just now and didnt seem to work, any ideas?
Should be:
ewriteRule ^shopping/([A-Za-z])/$ /living-in-brookline-ma/sh
Did you check out that image above? I am trying to see if I can use that plugin for redirects, they accept regex but I cant seem to get it to work? I know that Rewrite above needs to be modified a bit to work with the Redirection plugin.

Get a FREE t-shirt when you ask your first question.
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
http://yoursite.com/shopping/([A-Za-z])/
and target would be
http://yoursite.com/living-in-brookline-ma/shopping/$1/
Apache Web Server
--
Questions
--
Followers
Top Experts
The Apache HTTP Server is a secure, efficient and extensible server that provides HTTP services in sync with the current HTTP standards. Typically Apache is run on a Unix-like operating system, but it is available for a wide variety of operating systems, including Linux, Novell NetWare, Mac OS-X and Windows. Released under the Apache License, Apache is open-source software.