url-rewriting

What is the proper way to use add_rewrite_rule to remove the (question mark)?

 ̄綄美尐妖づ 提交于 2019-12-10 15:42:35
问题 I have a page called "People" with a custom template that takes in a variable called name: example.com/people/?name=FirstLast What I want is this: example.com/people/FristLast I know I need to use the add_rewrite_rule and add_rewrite_tag calls but I'm not sure how to achieve my desired result. I've tried this but I get a php error: add_rewrite_rule('^people/([^/]*)/?','index.php?name=$matches[1]','top'); add_rewrite_tag('%name%','([^&]+)'); The error I get is: "Fatal error: Call to a member

WordPress slug without custom post type slug

筅森魡賤 提交于 2019-12-10 15:38:17
问题 I have register custom post type with following code: register_post_type( array( 'labels' => // array of labels, 'public' => true, 'publicly_queryable'=> true, 'show_ui' => false, 'map_meta_cap' => true, 'show_in_menu' => false, 'query_var' => true, 'rewrite' => array( 'slug' => 'movie' ), 'capability_type' => 'post', 'has_archive' => false, 'exclude_from_search' => true, 'supports' => array('title'), ) ); The issue is that, the URL become for this post like: http://yourdomain.com/movie/post

Can someone prompt me in the right direction to use mod_rewrite?

↘锁芯ラ 提交于 2019-12-10 15:18:03
问题 I am a bit new to this but I am trying to learn. I know that in PHP we can have a URL that ends in ?id=something but it seems to me that some websites are doing it just forward slashes. Is this possible using PHP? I saw these questions that seem to say it is possible but I haven't cracked it yet. Can someone prompt me in the right direction for mod_rewrite ? I would like to change the following URL http://www.example.com/all-products/?onsale=true&topic=health&item=adaaos45 into http://www

Customize HTTP header in IIS URL Rewrite module

折月煮酒 提交于 2019-12-10 15:14:05
问题 I was stuck by a simple outbound rule, I want to modify the HTTP Content-Type to application/atom+xml , if the URL exactly matches http://wayneye.com/Feeds/Atom My rule XML: <outboundRules> <rule name="AtomFeedsIMEType" patternSyntax="ExactMatch"> <match serverVariable="RESPONSE_CONTENT_TYPE" pattern="http://{HTTP_HOST}/Feeds/Atom" /> <action type="Rewrite" value="application/atom+xml" /> </rule> Need help... 回答1: You are matching the server variable against the full URL, including domain

How to make Wordpress permalinks ignore custom url rewrite

不问归期 提交于 2019-12-10 14:44:55
问题 i'm currently working on a wordpress site that needs to have the option to be offered in french. i've found a way to make the theme work with the fr_FR po and mo files when i add a querystring variable l . i.e. site.tld will yield the vanilla english site, while site.tld/?l=fr will activate the following code in my functions.php to serve the french translation: <?php // http://codex.wordpress.org/Plugin_API/Filter_Reference/locale add_filter( 'locale', 'set_my_locale' ); function set_my

Routes.rb vs rack-rewrite vs nginx/apache rewrite rules

不打扰是莪最后的温柔 提交于 2019-12-10 13:46:59
问题 I have dozens of rewrite rules for legacy URLs from a previous incarnation of my application. I see three choices: Just add "match" lines in the routes file (config/routes.rb) Use rack-rewrite Create Nginx/Apache rewrite rules (Nginx in my case) I imagine that 3 has better performance than 2, which has better performance than 1. My questions: Is that true? If so, how much does it matter? Are there other trade-offs I might not have considered? Any other options altogether besides those three?

Apaches mod_rewrite VS. PHP routing?

北城以北 提交于 2019-12-10 13:12:30
问题 for some days now I have been trying to make a simple mod_rewrite rule to create friendly URLs, my web host have mod_rewrite enabled but I just can't get it to work. All the next questions where posted by me: .htacces to create friendly URLs Friendly URLs with .htaccess .htacces NOT working… None of the answers worked, so I'm thinking now using simple php routing instead and I wanted to know if there is a big performance or SEO difference between the two. And if there is, maybe you know how

Programmatically Producing rewritten URLs?

六月ゝ 毕业季﹏ 提交于 2019-12-10 12:17:14
问题 Using IIS Rewrite over a ASP.NET 4.0 application. Is there some function I could call from within ASP.NET that would transform a string URL to the rewritten URL? I would like to be able to do this in code-behind. Something like this: string ProduceRewrittenUrl(string publicUrl) 回答1: Yes this the HttpContext.Current.RewritePath(string) reference: http://msdn.microsoft.com/en-us/library/system.web.httpcontext.rewritepath.aspx a global place to call it is the protected void Application

Apache's Rewrite Condition not file (!-f) behaviour

偶尔善良 提交于 2019-12-10 12:11:20
问题 I have basic htaccess file: Options +FollowSymLinks RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ rewrite.php?data=$1 [L,QSA] It works as expected for the most part. What doesn't work as I would like it to is this: I have this link that doesn't rewrite as per the rule: http://domain.com/movies.php But also these url's are not rewritten either: http://domain.com/movies http://domain.com/movies/ http://domain.com/movies/fdgdgdgdg Is this normal behaviour? How can I fix

Codeigniter: how to remove index.php from URL?

帅比萌擦擦* 提交于 2019-12-10 11:56:55
问题 I've looked at many articles and tried different ways but it still doesn't work. Now my URLs look like mysite.com/index.php/[controller] . The goal is mysite.com/[controller] . In config.php : $config['index_page'] = ""; $config['uri_protocol'] = 'REQUEST_URI'; My .htaccess file contains RewriteEngine on RewriteCond $1 !^(index\.php|resources|robots\.txt) RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php/$1 [L,QSA] Also mod_rewrite is enabled