url-rewriting

redirect 404 to similar urls

浪子不回头ぞ 提交于 2019-12-02 15:11:14
I have a website with stories in it. I can have multiple types of stories within multiple categories like: children romance scifi action thriler quests The stories are accessible using urls like: www.example.com/action/story-name-action/ www.example.com/romance/story-name-romance/ and the first param (action) and the second (story-name-action) are redirected with .htaccess using rules. This part works just fine. Lately, I get few dozen of 404 from different sites and here's what I want to do but I dont know how: If someone types, for example: /action/story-nme-ction , I want to redirect to:

Nginx rewrite non-www-prefixed domain to www-prefixed domain

蓝咒 提交于 2019-12-02 15:07:53
I see the Nginx HttpRewriteModule documentation has an example to rewrite a www-prefixed domain to a non-www-prefixed domain: if ($host ~* www\.(.*)) { set $host_without_www $1; rewrite ^(.*)$ http://$host_without_www$1 permanent; # $1 contains '/foo', not 'www.mydomain.com/foo' } How can I do the reverse-- rewrite a non-www-prefixed domain to a www-prefixed domain? I thought maybe I could do something like the following but Nginx doesn't like the nested if statement. if ($host !~* ^www\.) { # check if host doesn't start with www. if ($host ~* ([a-z0-9]+\.[a-z0-9]+)) { # check host is of the

How to replace underscores in codeigniter url with dashes?

时光怂恿深爱的人放手 提交于 2019-12-02 14:56:07
I would like to know the simplest solution to changing the underscores of my codeigniter urls to dashes, for seo reasons. My controllers look like: public function request_guide() { ...Load view etc... } So to browse to this page I would have to go to: www.domain.com/request_guide But I want to be more seo friendly and use dashes instead of underscores, like so: www.domain.com/request-guide I am under the impression that codeigniter functions require underscores (might be wrong). In previous projects I have simply used mod_rewrite but I believe that these actions can be performed using routes.

URL Rewrite query database?

隐身守侯 提交于 2019-12-02 14:38:18
问题 I'm trying to understand how URL rewriting works. I have the following link. mysite.com/profile.php?id=23 I want to rewrite the above url with the users first and last name. mysite.com/directory/liam-gallagher From what I've read however you specify the rule for what the url should be output as, but how do I query my table to get each user name? Sorry if this is hard to understand, I've confused myself! 回答1: You are looking at this from the wrong direction. You can't do that kind of automatic

Magento Multi Store URL rewrite

不想你离开。 提交于 2019-12-02 14:37:55
问题 We are working on a Magento site that has several different stores. We are working on rewriting the url so when you are in a specific store, the store name is added to the url. We have tried a couple of different things. First by turning on "Add Store Code to Urls" in System>Configuration>Web. This causes one of the store names to be added to the url twice and the rest of the stores the base store name is added. Our second idea was to add: SetEnvIf Request_URI ^\/site_wow\/ MAGE_RUN_CODE=site

rewrite url with htaccess [closed]

做~自己de王妃 提交于 2019-12-02 13:12:59
First of all I am a beginner so please answer in details. My Problem: I want to write a .htacess rule for. www.asdf.com/city.php?city=New-York to www.asdf.com/New-York but also with that I have other pages such as www.asdf.com/country.php?country=USA which i would like to appear as www.asdf.com/USA and www.asdf.com/state.php?country=LA which i would like to appear as www.asdf.com/LA Pretty confused how to do that, any help, I really need to sort this out. THanks in advance Im not sure my approach is the best way to do it but this is how I'm doing it at the moment: RewriteRule ^([a-zA-Z0-9_-]+)

REQUEST_URI not matching explicit path and filename

狂风中的少年 提交于 2019-12-02 13:06:36
问题 Really stumped, because form and syntax seem fine. RewriteCond for REQUEST_URI is not matching the explicit path and filename. When isolated, RewriteCond for REQUEST_FILENAME matches just fine. I have verified using phpinfo() that REQUEST_URI contains the leading slash, and have tested without the leading slash, also. The goal here is to know that the request is for this file and, if it doesn't exist, then throw a 410. RewriteCond %{REQUEST_URI} ^/dir1/dir2/dir3/v_9991

how to write pretty URLs without htaccess file in php

心不动则不痛 提交于 2019-12-02 13:06:02
Pretty URLs without htaccess I want to write pretty URL like : http://yousite.com/member/1/ instead of http://yousite.com/index.php?page=member&id=1 But i did with htaccess file and now i want to do this without htaccess file because sometimes you don't have permission to edit htaccess file on server. If you have an Apache server and AcceptPathInfo is enabled, then you can just use links like /index.php/nice/looking/url. The "index.php" in the middle of the URL might look a little strange, but I don't think it's possible to have it look better without .htaccess Else, you could ask your hoster

Spark rdd write in global list

百般思念 提交于 2019-12-02 13:03:27
How to write in global list with rdd? Li = [] Fn(list): If list.value == 4: Li.append(1) rdd.mapValues(lambda x:fn(x)) When I try to print Li the result is: [] What I'm trying to do is to transform another global liste Li1 while transforming the rdd object. However, when I do this I have always an empty list in the end. Li1 is never transformed. vvladymyrov The reason why you get Li value set to [] after executing mapValue s - is because Spark serializes Fn function (and all global variables that it references - it is called closure) and sends to an another machine - worker. But there is no

pretty url with .htaccess?

纵饮孤独 提交于 2019-12-02 12:56:53
i just created a new wordpress page template that runs some php&mysql scripts inside it and i would like to apply mod rewrite to it's subpages. for instance i have the following link generated: http://www.quotist.com/quotes-by-authors.html?letter=D how can i transform this into something like: http://www.quotist.com/quotes-by-authors/letter/d/ ? in my htaccess i have the default code generated by wordpress ... does anyone know how to achieve that? Try this: Options +FollowSymLinks -MultiViews -Indexes RewriteEngine on RewriteBase / RewriteCond %{ENV:REDIRECT_STATUS} 200 RewriteRule ^ - [L]