url-rewriting

rewrite url condition for subfolder

▼魔方 西西 提交于 2019-12-24 00:38:19
问题 I have an htaccess file here /en/.htaccess and i would like to make this condition (which is for the main htacces inside public_html) to work also for the subfolder en RewriteCond %{THE_REQUEST} /events/eventDetails\.php\?id=(.+)&name=(.+)\sHTTP [NC] RewriteRule ^ /events/%1/%2? [L,R] RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^events/([^/]+)/([^/]+)/?$ /events/eventDetails.php?id=$1&name=$2 [L] my htaccess starts like this. RewriteEngine on

PHP code to determine if a user was 301 redirected to my site

别来无恙 提交于 2019-12-24 00:24:55
问题 Is it possible in PHP to know if a user has been 301 redirected to my website? So in myoldsite.com I have a 301 redirect in the .htaccess file to mynewsite.com . Can I place some PHP code in mynewsite.com to recognise when a user has been 301 redirected? I just need this to display a specific message if this is the case. Many thanks for any pointers here :-) 回答1: I believe with 301-redirects the HTTP_REFERER field will contain the original referer: User enters oldsite.com in address bar and

Nginx block access to php files

白昼怎懂夜的黑 提交于 2019-12-24 00:24:05
问题 I've created a simple php file to display info fetched from my MYSQL database. Right after that i use a rewrite rule in Nginx to make the link seo friendly and to mask the .php file that fetches it. Ex: http://localhost/myfile.php?seo=how-to-install-linux After rewrite rule the i can access it like: http://localhost/how-to-install-linux My rewrite rules are: location / { rewrite ^/([a-zA-Z0-9_$\-]+)$ /myfile.php?seo=$1 last; rewrite ^/(.*)/$ /$1 permanent; <- just to block trailing slash } My

Apache rewrite rule

可紊 提交于 2019-12-23 22:17:50
问题 I want to redirect "http://localhost/b.html" --> "http://localhost/a.html" I tried RewriteRule for that. But somehow it is not working for me. I am using apache2 and my httpd.conf contains: LoadModule proxy_module modules/mod_proxy.so LoadModule proxy_http_module modules/mod_proxy_http.so LoadModule proxy_connect_module modules/mod_proxy_connect.so LoadModule rewrite_module modules/mod_rewrite.so RewriteEngine On RewriteRule ^/b.html$ http://localhost/a.html When I tri "http://localhost/a

Add rewrite rule in plugin: with .htaccess in plugin folder or using WordPress functions

余生长醉 提交于 2019-12-23 20:17:11
问题 I need add a rewrite rule in my plugin, and distribute it with my code. All works fine if I put the rule in the .htaccess in the WordPress root folder, but I need distribute the plugin with my rule. I try to put a .htaccess inside the plugin folder and try to use the add_rewrite_rule function but doesn't works either. Here the .htaccess code that works correctly in WordPress root folder but doesn't works in my plugin folder: <IfModule mod_rewrite.c> RewriteEngine On RewriteRule my-plugin

Seam 2.2.0 URL rewrite not working

﹥>﹥吖頭↗ 提交于 2019-12-23 19:15:56
问题 I'm trying a simple example of URL rewriting, but it's not working for me. I'm using Seam 2.2.0 deployed to JBoss 5.1.0. My pages.xml contains: <page view-id="/html/index.xhtml"> <rewrite pattern="/home" /> </page> and <page view-id="/html/common/redirect.xhtml" action="#{redirectAction.redirect}"> <rewrite pattern="/link" /> ... My components.xml contains: <web:rewrite-filter view-mapping="*.seam"/> As far as I can tell from the documentation, that should be all I need. However, none of the

url rewrite rule does not ignore request for file

ε祈祈猫儿з 提交于 2019-12-23 17:32:26
问题 http://www.iis.net/learn/extensions/url-rewrite-module/url-rewrite-module-configuration-reference <rule name="AngularJS Routes" stopProcessing="true"> <match url=".*" /> <conditions logicalGrouping="MatchAll"> <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /> </conditions> <action type="Rewrite" url="/index.html" /> </rule> The above is a one of several url rewrite rules widely suggested for angular single page apps. I understand the rule to mean "If the request is not for a

URL Rewrite Filter not working with query parameters containing special characters

风流意气都作罢 提交于 2019-12-23 17:06:27
问题 I'm using URL Rewrite Filter to forward some ugly URLs to pretty Urls. Referring to Conditions Based On URL Parameters, I’ve done something using UrlRewriteFilter which is actually required to make my site Google crawl-able. Here’s how it goes. <rule enabled="true"> <note> The rule means that requests to /test/status/ will be redirected to /rewrite-status the url will be rewritten. </note> <condition type="parameter" name="_escaped_fragment_" operator="equal">(apple|kiwi|orange)</condition>

Improve converting string to readable urls

我怕爱的太早我们不能终老 提交于 2019-12-23 16:45:57
问题 The following function rewrites urls from news and product titles that contain all sorts of characters. The string I wish to create consists of only alphanumeric values and "-", but no ending "-" or whitespace and no repeated "-". The below function works fine, but I wondered if there is any way to write it simpler or more efficient? function urlName($string) { $string = trim($string); // no open ends $string = strtolower($string); // all lowercase $string = strtr($string, 'äöåÄÖÅ', 'aoaaoa')

.htaccess rewrite rules for multiple parameters

混江龙づ霸主 提交于 2019-12-23 16:35:46
问题 Rewriting the following 3 URLs http://example.com/index.php?page=search to http://example.com/search http://example.com/index.php?page=profile&value=myname to http://example.com/myname http://example.com/index.php?page=stats&type=daily to http://example.com/stats/daily Current .htaccess is written as the following: Options -MultiViews RewriteEngine On RewriteBase / RewriteCond %{THE_REQUEST} /index\.php\?page=([^\s&]+)&value=([^\s&]+) [NC] RewriteRule ^ index/%1/%2? [R=302,L,NE] RewriteCond %