url-rewriting

WordPress child categories not working in urls like they should

倾然丶 夕夏残阳落幕 提交于 2019-12-13 06:15:34
问题 I am using this plugin called, "Custom Post Type Permalinks", which kinda helps me to get a post type to line up with a custom taxonomy that I created called, product_category , but I can't get the product_category taxonomy links proper with /shop/ in front of them that work with Child Categories also. Basically, the custom post type is product and has a url structure like so: /shop/category/{Category Parent}/{Category Child}/{Product Name} and looks like the following in functions.php when

Rewrite Wordpress' Blog Archive URL structure

陌路散爱 提交于 2019-12-13 06:12:31
问题 Currently, my website's archive page lists are displaying as: example.com/2012/05 I would like to change the url structure to: example.com/blog/2012/05 I've tried using Redirects in combination with rewrites but I am not sure that works well. I've also just tried to do a simple rewrite like RewriteRule ^([0-9]+)/([0-9]+)/$ /blog/$1/$2 [L] to capture /year/month urls and convert them but I am unsuccessful. I know how to edit the archive navigation menu to prepend a blog/ before the rest of the

Can PHP access the .htaccess rewrite name of a file

和自甴很熟 提交于 2019-12-13 06:08:11
问题 My .htaccess works (not an expert, but do a lot of copy & paste). A typical rewrite for one of my pages looks like this: RewriteRule ^my-grills-parts-and-service/?$ parts-service.php [NC,L] ...where the url "http://www.mydomain.com/my-grills-parts-and-service/" will invoke the parts-service.php file. However, I am using php to construct a fully qualified URL, from what is in the address bar. The problem is, the server variable $_SERVER['SCRIPT_NAME'] will return "parts-service.php", rather

Rewriting public assets to omit file extension

。_饼干妹妹 提交于 2019-12-13 06:00:45
问题 For the sake of formality, I want to trim my asset URIs so that file extensions are omitted. For example, if I request /resources/stylesheets/common , Apache will return /resources/stylesheets/common.css . At the moment, I'm using the following rewrite to get this to work: RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_URI}.css -f RewriteRule ^ /%{REQUEST_URI}.css [L] This works, as it should. However, I need to also do this for other resources, like images and scripts. For simplicity, I would like

howto rewrite engine rule

假如想象 提交于 2019-12-13 05:43:42
问题 i'm trying to understand some rules or rewrite engine but i can't figure how to do it. i have this link: w**.example.com/index.php?city=new+york and i wish to rewrite to this new: w**.example.com/good-parties-in-new-york the value of city can change to any other city. but the point here is I only what to rewrite if all the key is: index.php?city= because the index.php?zone= is used for other things, etc... any suggestion? thanks. 回答1: I'm a little confused on what exactly you want to achieve.

IIS URL Rewrite Default Language Path

痞子三分冷 提交于 2019-12-13 05:42:47
问题 I'm trying to get a rule working whereby the language identifier is in the url path. We want to force the url to the en version if a language is not specified. For example: www.domain.com/page.aspx should redirect to www.domain.com/en/page.aspx Here's the rule we have so far, but it keeps ending up in a redirect loop. <rule name="Default Language" stopProcessing="true"> <match url="(.*)" /> <conditions> <add input="{REQUEST_URI}" pattern="^/(en|es|ph)/" negate="true" ignoreCase="true" /> <

Apache rewrite rule different if capture is empty

前提是你 提交于 2019-12-13 05:40:38
问题 what I have so far is: <VirtualHost 111.111.111.111:80> ServerName ex.me ServerAlias www.ex.me Options +FollowSymLinks RewriteEngine on RewriteRule ^/(.*)$ http://exemple.com/foo/$1 [R=301,L] </VirtualHost> what I need is if (.*) is empty, it rewrites to http://exemple.com and if it has something, it redirects to http://exemple.com/foo/$1 -- I don't know how to do the if empty rule. right now. Right now it redirects to http://exemple.com/foo/ no matter if there is something captured or not.

Nginx, Wordpress and URL rewriting problems

自古美人都是妖i 提交于 2019-12-13 05:31:36
问题 Trying to get Nginx and Wordpress to play nicely but it seems that they don't understand each other quite yet, especially in terms of pretty urls and rewriting. I have the following snippet in my config file for nginx at the bottom (got it from Nginx's wiki page on WP), and I keep getting this error message in my error log, which makes me think it's not even trying to rewrite the location. 2011/04/11 09:02:29 [error] 1208#1256: *284 "c:/local/path/2011/04/10/hello-world/index.html" is not

Rewrite Wordpress Custom Post Type URL

泄露秘密 提交于 2019-12-13 05:29:24
问题 I’m creating a hotel booking site plugin in WordPress. I use custom post types for the hotels and rooms. Since most hotels have similar room names, I would like to rewrite the URL for the rooms so the hotel name is also included. For example: http://abookingsite.com/hotels/hilton-hotel/standard-room hilton-hotel is the title of the hotels post type and standard-room is the rooms post type. Any ideas if this can be done? Thanks 来源: https://stackoverflow.com/questions/21374715/rewrite-wordpress

override apache rewrite rules with htaccess

跟風遠走 提交于 2019-12-13 05:17:23
问题 working on a server that hosts multiple domains. Somewhere in apache config is a rewrite rule that is set for ALL domains. What happens is if a user goes to example.com/foo they are supposed to get redirected to example.com/foo_bar However, in one domain, I want to override this behavior so that the url stays at example.com/foo and does not redirect. I've been searching and trying various rules and conditions to no avail. I don't have access to the apache config, but I am using .htaccess for