Menu
  • HOME
  • TAGS

Wordpress custom permalinks

wordpress,.htaccess,rewrite,custom-post-type,permalinks

I manage to solve my issue and create the permalinks the way I wanted. I created my post types like I wanted but I had to put a lot of if/else statement in my header to properly manage my pages and post type to ensure that the right page was...

Drupal 7 rewrite is removing get parameters from query string

php,drupal,drupal-7,rewrite

It turns out that there was a bug in the latest release that in /modules/contrib/link/link.module that was causing the query strings to be stripped from the url in the token. I replaced the code in this file with the code from the pre-upgrade version and it began behaving as expected...

Prevent extension automatically added at the end of url (htaccess ?)

.htaccess,url,rewrite

You can use this in your .htaccess or config file : Options -MultiViews ...

Nginx - How to redirect dropping a character from URL

regex,redirect,nginx,rewrite

The following should work: rewrite ^/board/(.*)t(\d+)\.html$ http://example.com/forum/$1$2 permanent; Regex Demo...

HTAccess with multiple variables

php,apache,.htaccess,rewrite

The regular expression is exactly the same for both rules, which means the first rule will match and the second rule does absolutely nothing. This applies to each of your sets that are exactly the same. You need some other qualifier to differentiate between the "order" and the "cat" parameter....

For how long a router keeps records in the NAT and can they be reused forwarding requests from other hosts?

udp,rewrite,router,packet,nat

It depends. According to Section 4.3 of RFC 4787, the UDP timeout of a NAT should not be smaller than 2 minutes (180 seconds), except for selected, well-known ports. In practice, however, routers tend to use smaller timeouts. For example, OpenWRT 14.07 uses a timeout of just 60 seconds. For...

Domain Rewrite for both HTTP and HTTPS in IIS 7

redirect,iis-7,web-config,rewrite,isapi-rewrite

This is not really a solution as I found the actual problem with IIS. When you visit https://example.com with the rules above setup (or https canonical redirect) it will first give you a certificate error if you don't have the "naked domain" certification. If the user opt to continue, then...

HTACCESS Profile Redirection Regex Not Substituting

php,.htaccess,rewrite

The rewrite engine loops through all the rules until the URI stops changing. Because of that, the view.php is matching the ([^/]+) regex the next time the rules loop. Try adding some conditions: RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^profile/([^/]+) profile/view.php?username=$1 [L,NC] EDIT: bit of an explanation The rewrite...

.htcaccess in Apache not working

linux,apache,.htaccess,rewrite

There is an typo. Normally the file name is .htaccess, not .htcaccess. An other option is to set the file-name to you "personal style", like: AccessFileName .htcaccess http://httpd.apache.org/docs/2.2/howto/htaccess.html...

.htaccess rewrite $_GET variables

php,.htaccess,rewrite

You should specify more precicely what the allowed type of character is and you should make sure your previous rules don't cause your later rules to be ignored. So you should put your most specific rule first and if you want digits for your news- and page ID's, you should...

Grouping file extensions for re-writing URL's [.htaccess]

.htaccess,mod-rewrite,url-rewriting,rewrite,file-extension

Unfortunately, this is not possible. The TestString part of RewriteCond can only contain a plain string, and allows for server variables (HTTP_REFERER, for example) and back-references ($1 and %1, for example). As such, you cannot include an expression in the TestString - only the CondPattern (the second part of RewriteCond)...

URL Rewrite Doesn't Work as Expected - Hide svc extension

c#,wcf,rewrite,isapi

What I did to resolve it: I fixed the failed request tracing log files not appearing, turns out you need to configure in the IIS settings the status codes for which the trace should occur, as it's not smart enough to select all by default. Then via the trace file...

Rewrite rules html/php

php,html,.htaccess,rewrite

There is no need for a wildcard if you're looking for a sp[ecific URL and only the number changes RewriteRule ^poll/(\d+)/$ polls.php?poll=$1 or better to get always 6 digits RewriteRule ^poll/([0-9]{6})/$ polls.php?poll=$1 That should do...

Removing last subdirectory from url with htaccess

regex,.htaccess,redirect,rewrite

You can use this rule in root .htaccess: RedirectMatch 301 (?i)^/(.*?)/feed/?$ /$1 ...

Need to always redirect to page.php?id=xxxx when an url contains &a=dl

apache,.htaccess,mod-rewrite,redirect,rewrite

You can use this code in your DOCUMENT_ROOT/.htaccess file: RewriteEngine On RewriteCond %{QUERY_STRING} ^(id=[^&]+).*?&a=dl [NC] RewriteRule . %{REQUEST_URI}?%1 [L,R=302] ...

apache .htaccess rewrite should not include www

regex,apache,.htaccess,mod-rewrite,rewrite

You can have a single rule to handle both http and https traffic: RewriteEngine On RewriteCond %{HTTP_HOST}#%{HTTPS}s ^www\.([^#]+)#(?:off|on(s)) [NC] RewriteRule ^ http%2://%1%{REQUEST_URI} [R=302,L,NE] ...

How do I redirect ONE url to write around a typo in a link “index.ph”?

.htaccess,rewrite

You can use this code in your DOCUMENT_ROOT/.htaccess file: RewriteEngine On RewriteRule ^(important/index\.ph)$ /$1p [L,NC,R=302] ...

Trouble Understanding URL Rewrite to Proxy to Another Server

regex,apache,rewrite

You really don't need the first condition because the rewrite rule takes care of that. You can try this rule here. RewriteEngine On RewriteCond %{QUERY_STRING} userid=(.*) RewriteRule ^/?abc/start$ https://5.6.7.8/operate?service=checkuser&userid=%1 [P] ...

redirect certain pages to its equivalent in another domain, otherwise redirect to its homepage

apache,.htaccess,rewrite,url-redirection

I'm not sure what you mean by But don't know how to exclude other pages But you are already excluding the pages when you create specific rules for them. This should work. <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / #redirect specific pages RewriteRule ^certain-page$ http://new-domain.com/certain-page [R=301,L] RewriteRule ^another-certain-page$ http://new-domain.com/another-certain-page [R=301,L] #Redirect...

How to get an .htaccess rewrite rule with filtering directory and keeping parameters [duplicate]

php,apache,.htaccess,mod-rewrite,rewrite

You can use this code in /adServer/js/.htaccess: RewriteEngine On Options +FollowSymlinks RewriteBase /adServer/js/ RewriteRule ^([^/]+)/([^/]+)/ADTECH/?$ test.php?a=$1&b=$2 [L,QSA,NC] Changes are: Add required flags in RewriteRule. Esp important is QSA to preserve original query string. Add appropriate RewriteBase. Remove redundant RewriteCond Use relative path for rewriting in RewriteRule. ...

How can I strip subfolder with mod_rewrite

apache,.htaccess,mod-rewrite,redirect,rewrite

You can use this root .htaccess: RewriteEngine on RewriteRule ^(?:es|jp|ko)(/mypage)$ $1 [NC,R=301,L] If you try to rewrite all the content for languages, you can use: RewriteRule ^(?:es|jp|ko)(/.+)$ $1 [NC,R=301,L] And for redirect also directories alone (ex: mydomain.com/es -> mydomain.com): RewriteRule ^(?:es|jp|ko)(/.*)?$ $1 [NC,R=301,L] ...

RewriteRule to remove version number

apache,.htaccess,mod-rewrite,redirect,rewrite

Make sure to escape the dot otherwise it will match any character. Besides just this single rule should work for both cases: RewriteRule ^(/?static/deploy/.+?)\.\d+\.(js|css)$ $1.$2 [L,NC] ...

Forcing SSL on signup but removing SSL on non-signup pages

wordpress,.htaccess,mod-rewrite,ssl,rewrite

Keep these 2 rules as your very first rule: RewriteEngine On RewriteCond %{HTTPS} off RewriteCond %{THE_REQUEST} \s/+(signup-page|example-page) [NC] RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L] RewriteCond %{HTTPS} on RewriteCond %{THE_REQUEST} !\s/+(signup-page|example-page) [NC] RewriteRule ^ http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L] ...

nginx rewrite for subsubdomains to subdomains

nginx,rewrite

Wildcarded server takes precedence over regexp'ed one and matches 'www...' too. You can use one definition for both cases: server_name ~ ^(?:.*\.)?(.*)\.ourapp\.com$; return 301 https://$1.ourapp.com$request_uri; ...

nginx - proxy/rewrite based on location

nginx,rewrite,proxypass

After much trial and error and searching, I found the following works: location ^~ /api/ { rewrite ^/api/(.*) /$1 break; proxy_pass http://127.0.0.1:3030/; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } ...

Is possible to rewrite all values in array without for loop in javascript?

javascript,arrays,rewrite

Anything you do will end up looping in some fashion. However, you don't have to loop... because we now have functional array methods! You're probably looking for map or reduce, perhaps both, since you want to transform (map) each element and/or combine them into one (reduce). As an example, we...

Rewrite engine for wildfly

java,java-ee,rewrite,wildfly

You can use Predicates Attributes and Handlers provided by undertow, you must add the file undertow-handlers.conf into WEB-INF directory with the rules. Another alternative is use prettyfaces....

.htaccess redirect rule same domain but different prefix

.htaccess,rewrite,prefix

You can use this .htaccess: RewriteEngine on RewriteCond %{HTTP_HOST} ^admin\. [NC] RewriteRule ^ http://myadmin.example.us%{REQUEST_URI} [NE,L,R=301] ...

nginx rewrite Issue, why does it just replaces one matched string?

nginx,rewrite

Assuming that the first instances of user and personare constant and that there is always a slash after the second item, you can try: rewrite ^/user/user_([^/]+)/(.*)$ /person/person_$1/$2 ; ...

How to create rewrite rule to Rename PDF file on the fly while Downloading using nginx?

mod-rewrite,nginx,rewrite

You can't use both alias and rewrite together if I remember correctly. Instead, just use a location regex match and those captures will be available to both the add_header and alias directives: location ~* /download-pdf/([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F]+)\.pdf$ { add_header Content-Disposition 'attachment; filename="$arg_title"'; alias /usr/share/nginx/basesite/html/contents/$1/$2/$3/$4/$5/$1$2$3$4$5$6.pdf; } This will match this URL:...

No refresh register form [closed]

php,ajax,url,mod-rewrite,rewrite

You can submit the information via POST. The way you are submitting the data across is from a GET HTTP request. The best thing to do is submit it over via post data. I am assuming your frontend call is using ajax for the form submission? if not and using...

Removing index.php from CodeIgniter url redirects to localhost

php,.htaccess,codeigniter,rewrite

RewriteEngine on RewriteBase /job RewriteCond $1 !^(index\.php|images|table-images|robots\.txt|styles|js|uploads) RewriteRule ^(.*)$ index.php/$1 [L] and set in application/config/config.php $config['base_url'] = 'http://127.0.0.1:8000/job/'; $config['index_page'] = 'index.php'; ...

.htaccess URL-Rewrite solution?

apache,.htaccess,mod-rewrite,url-rewriting,rewrite

You can use this code in your /subfolder/search-brands/.htaccess file: RewriteEngine On RewriteBase /subfolder/search-brands/ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^([^/]+)/([^/]+)/?$ index.php?q=$1&brand=$2 [L,QSA] ...

How bad is $wp_rewrite->flush_rules() on 'init' action hook?

wordpress,performance,rewrite

There is a 'rewrite_rules' record in the 'wp_options' table that includes all the rewrite rules. When calling flush_rules(), WordPress will clear this record and regenerate all the new rules, including the ones you're not changing.

nginx redirect old URL to new URL

redirect,nginx,rewrite,url-redirection

Try to put rewrite ^/parent(.*) http://$server_name/new-parent$1 permanent; into server directive, not into /parent location. If this still will not work, provide us with access.log entry with case when you've got wrong redirect.

Regex url rewriting not working for arguments with spaces

regex,apache,.htaccess,url,rewrite

Problem is use of .* in your regex. Try this rule: RewriteRule npcview-([^-]+)-(.+?)\.html$ npc?npcid=$1&name=$2 [L,QSA] ...

Remove site to another domain

.htaccess,mod-rewrite,rewrite

If it's in a subfolder you need to add the rewritebase. Make sure this .htaccess is also in /site/.htaccess RewriteEngine on RewriteBase /site/ RewriteCond $1 !^(index\.php|public|media|robots\.txt) RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php/$1 [L,QSA] ...

Python3 Pysmb Random Access Remote Shared File

python-3.x,random,rewrite,shared,smb

Current pysmb release 1.1.14 doesn't support this yet, please refer to comment 41-44 in page MikeTeo.net . It may be supported in later release. A reminder that since Version 1.1.15, this enhancement is implemented....

htaccess redirect 301 + rewriterule conflict

.htaccess,redirect,rewrite,redirecting

You're mixing directives from two different modules, mod_rewrite and mod_alias. Since both modules get applied to the same request, and neither modules care what the other is doing, you can have both modules redirect the same request. In order to prevent that, you need to just use mod_rewrite: RewriteEngine on...

How to process argument with dot in .htaccess?

regex,apache,.htaccess,apache2,rewrite

Your last rules seems to be overly complicated. You can use: RewriteCond %{QUERY_STRING} !(?:^|&)query=[^&]+ [NC] RewriteCond %{REQUEST_URI} ^/([^/]+)/?$ RewriteRule . /link_handler.php?query=%1 [L,QSA,B] ...

Network log shows 404 at beginning of load for folders within wordpress site

php,wordpress,.htaccess,rewrite,http-status-code-404

With birgire's help, I figured this one out: The fix was as simple as replacing: include dirname(__FILE__).'/../wordpress/wp-blog-header.php'; with include dirname(__FILE__).'/../wordpress/wp-load.php'; More information in this thread from wordpress.stackexchange.com...

.htaccess doesn't redirect direct link to .php files

php,.htaccess,redirect,rewrite

The rule you posted is only checking if the file/directory exists, and if it doesn't, then redirect to requestHandler.php. So naturally, if an existing file is entered in the URL, it will not redirect. If you want all ".php" files to get redirected as well, you'll need a more specific...

Nginx config rewrite rule combination

.htaccess,url,nginx,rewrite,config

Try switching the order: location ~ /details { rewrite ^/details/(.*)/(.*)/(.*)/(.*)_(.*)_(.*).html$ /site/$4.$5.$6.html permanent; rewrite ^/details/(.*)/(.*)/(.*)/(.*)_(.*).html$ /site/$4.$5.html permanent; } Because (.*) matches everything, it'll gobble up everything including _ characters, so your first regex matches everything the second one does and thus the second rule never gets reached....

.htaccess rewrite - redirect pages

apache,.htaccess,mod-rewrite,redirect,rewrite

You can use this code in your DOCUMENT_ROOT/.htaccess file: Options -Indexes +FollowSymLinks RewriteEngine On RewriteBase / RewriteCond %{HTTPS} off RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{THE_REQUEST} !/search/ [NC] RewriteRule ^(.*)$ search/$1 [L,R] RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f <IfModule mod_php5.c> RewriteRule ^(.*)$ index.php/$1 [L] </IfModule>...

Using mod rewrite for images

image,mod-rewrite,rewrite

Try this rule RewriteRule ^([^/]+).jpg$ /servers/srv_fr/$1.jpg [L] ...

Rewrite rule: change a portion of text in URL to another

wordpress,url,mod-rewrite,url-rewriting,rewrite

If I understand correctly what you want, your rewrite rule is reversed and you are not including the following directory. Try: RewriteRule ^/gardens/(.*)$ /portfolio_category/$1 [NC] This changes /gardens/ to /portfolio_category/. The (.*)$ collects everything to the end of the URL, then the $1 adds it at the end of the...

Having issues with regex matching wrong URLs in NGINX rewrite

nginx,rewrite

Try to add "^" to the beginning of regexp location ~* ^/(\d+)/([+\w-\ ]+)/?$ So it will match only if first part of URI contains digits and not "posts" or something...

Force https redirect on all http requests on IIS

asp.net,https,rewrite,iis-7.5

This is what we use <rule name="httpsredirect" stopProcessing="true"> <match url="(.*)" /> <conditions> <add input="{HTTPS}" pattern="off" ignoreCase="true" /> </conditions> <action type="Redirect" redirectType="Permanent" url="https://{HTTP_HOST}/{R:1}" /> </rule> I can see a few differences - we have {R:1} where you have {REQUEST_URI} and we just have one condition entered which turns off https so...

use image/media/binary file for directory index (or pretty URLs for images/media)

image,apache,.htaccess,mod-rewrite,rewrite

Assuming only the album part of the URL varies, you can use the following .htaccess RewriteEngine on # Block direct index requests RewriteCond %{THE_REQUEST} \ /releases/[^/]+/covers/front/((pdf|png)/)?index\.(jpeg|pdf|png)\s [NC] RewriteRule ^ - [F] # Resolve pretty URLs RewriteRule ^(releases/[^/]+/covers/front)/?$ /$1/index.jpeg [NC,L] RewriteRule ^(releases/[^/]+/covers/front)/(pdf|png)/?$ /$1/$2/index.$2 [NC,L] ...

Nginx config rewrite with PATH_INFO

php,apache,.htaccess,nginx,rewrite

Use last in rewrite and fastcgi_split_path_info for fix the PATH_INFO, eg.: Note: use entire path in rewrite (like example) and in location location ~ ^/project/(?!index\.php/.*|index\.php$|statics/.*|data/.*)([a-zA-Z0-9\-\/.]+)$ { rewrite ^/project/(?!index\.php/.*|statics/.*|data/.*)([a-zA-Z0-9\-\/.]+)$ /project/index.php/$1 last; } location ~ ^/project/(?!index\.php).*\.php$ { deny all; } location ~ [^/]\.php(/|$) { fastcgi_split_path_info ^(.+?\.php)(/.*)$;#Fix PATH_INFO fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; include...

Htaccess recursively replace underscores with hyphens

.htaccess,redirect,rewrite

One of these implementations will cause 500 internal error if there are more than 10 underscores to be replaced by hyphen since default value of LimitInternalRecursion variable is 10. Here is one way you can make these replacements work for 20 underscores: RewriteEngine On # if there is only one...

.htaccess Rewrite for PDF file for different domains

.htaccess,rewrite

You can use this code in your DOCUMENT_ROOT/.htaccess file: RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} ^(?:www\.)?domain\.com$ [NC] RewriteRule ^((?!domain_com/).+?\.pdf)$ domain_com/$1 [L,NC] RewriteCond %{HTTP_HOST} ^(?:www\.)?domain\.eu$ [NC] RewriteRule ^((?!domain_eu/).+?\.pdf)$ domain_eu/$1 [L,NC] ...

htaccess url rewrite with RegEx

regex,.htaccess,url,rewrite

You can use this fix: RewriteCond %{QUERY_STRING} ^back= RewriteRule ^sample$ /sample? [R=301,L] This will redirect http://example.com/sample?back=my-account to http://example.com/sample. Apparently, your condition was not met since the query string starts with back, and to get rid of the query string, you need to add ? to the end of replacement string....

Rewrite htaccess so it doesn't need to repeat itself

apache,.htaccess,mod-rewrite,rewrite

You can use regex alternation: RewriteRule ^(CAKE_MIX|COOKIE_DOUGH|ICE_CREAM)/\.php$ $1/index.php [R,L] RewriteRule ^(CAKE_MIX|COOKIE_DOUGH|ICE_CREAM)$ $1/ [R,L] RewriteRule (CAKE_MIX|COOKIE_DOUGH|ICE_CREAM)/faqs\.php$ /faqs/faqs.php?cat=$1 [QSA] RewriteRule (CAKE_MIX|COOKIE_DOUGH|ICE_CREAM)/index\.php$ /overview/overview.php?cat=$1 [QSA,L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} /(CAKE_MIX|COOKIE_DOUGH|ICE_CREAM)/ RewriteRule ....

Nginx rewrite rule without changing url

linux,url,nginx,webserver,rewrite

Try location ~ ^/newpath { rewrite ^/newpath/(.*) /old/path/$1 break; } ...

Nginx. Something like drupal in root and Magento in subfolder

magento,drupal,nginx,rewrite,subfolder

Best way is use some subdomain for magento, like https://shop.yourdomain.com. But if you want to keep it as http://yourdomain.com/magento you need to remove separate nginx config file for Magento and add /magento/ location to root config. I mean: location /magento/ { root /var/www/domain/magento; #main thing index index.html index.php; try_files $uri...

Regex - get last part of url and strip .php

regex,rewrite

^.*/(.*?)\.php Try this.This will do it.See demo https://regex101.com/r/pM9yO9/9...

Replacing the URL on a local page

php,url,rewrite

I am not sure that you can use session but can cookie with the code below in htaccess. Suppose, yuo already set cookie username as Tommy RewriteEngine on RewriteCond %{HTTP_COOKIE} username=(\w+) RewriteRule meet/myprofile.php /meet/%1 then /meet/myprofile.php will be redirected to /meet/Tommy...

nginx rewrite exclude subdomains

regex,nginx,rewrite

server { listen 80; server_name .example.com; location /list/ { if ($host !~ ^(xxx|yyy|zzz)\.example\.com) { return 301 http://demo.example.com/list/; } # .... } } ...

rewrite URL to new one

.htaccess,mod-rewrite,url-rewriting,rewrite

There are a ton of answers for this here on SO for your exact scenario already. This is a very common request. So this will work for this type of link http://example.com/123/newurl Use this RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^([^/]+)/([^/]+)/?$ /page.php?id=$1&link=$2 [L] ...

How to write my rewriterule so I can have friendly url

.htaccess,seo,rewrite,opencart,friendly-url

You can place this rule above the others and see how it works for you. RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\?information/information&information=9 RewriteRule .* /Livraison-Gratuite? [R=301,L] ...

Nginx redirect http subdomains to https

ubuntu,redirect,ssl,nginx,rewrite

Your web server is setup with Strict-Transport-Security max-age=16070400; includeSubdomains. This will tell the web browser to request your domain using https only. If you want the subdomain blog to be accessed through insecure http, you will need to remove includeSubdomains from the HTTP Strict Transport Security (HSTS) and use a...

Apache Rewrite does not work

apache,.htaccess,rewrite

Why are you using both? You should either put all .htaccess code in the config or all in .htaccess. It's recommended to use the config for all of it and set AllowOverride to None for better performance. .htaccess is mainly for shared hosting when you don't have access to the...

Apache log: Request exceeded the limit of 10 internal redirects

.htaccess,rewrite,webpage

Those rules create an infinite loop RewriteRule ^(.*)\.css$ $1.css [L] RewriteRule ^(.*)\.png$ $1.png [L] RewriteRule ^(.*)\.jpg$ $1.jpg [L] RewriteRule ^(.*)\.gif$ $1.gif [L] RewriteRule ^(.*)\.js$ $1.js [L] RewriteRule ^(.*)\.swf$ $1.swf [L] and are, by the way, useless (so you can remove them). You have also many design issues in your code...

Rewrite URL to get contents from sub-directory

.htaccess,mod-rewrite,rewrite

I have managed to get this working with the following code: Options +FollowSymLinks RewriteEngine on RewriteCond %{REQUEST_URI} !(.*)your_directory RewriteRule ^(.*)$ your_directory/$1 [L] ...

rewrite url from http to https using htaccess

apache,.htaccess,mod-rewrite,redirect,rewrite

You can use this code in your DOCUMENT_ROOT/.htaccess file: RewriteEngine On RewriteCond %{HTTPS} on RewriteRule ^non(/.*)?$ http://{HTTP_HOST}$1 [L,NC,NE,R=302] ...

Redirect HTTP to HTTPS in Undertow

https,rewrite,undertow

This answer pointed in the right direction. Programmatically, one has to add a SecurityConstraint to Builder and set ConfidentialPortManager: DeploymentInfo servletBuilder = Servlets.deployment(); servletBuilder.addSecurityConstraint(new SecurityConstraint() .addWebResourceCollection(new WebResourceCollection() .addUrlPattern("/*")) .setTransportGuaranteeType(TransportGuaranteeType.CONFIDENTIAL) .setEmptyRoleSemantic(EmptyRoleSemantic.PERMIT)) .setConfidentialPortManager(new ConfidentialPortManager() { @Override public int...

Creating an SEO friendly URL with Htaccess File

.htaccess,mod-rewrite,url-rewriting,seo,rewrite

If you've changed all of your links so that they look like this: http://www.mywebsite.com/report/38678a80dfea5924 Then in the htaccess file inside the "report" folder, you just need: RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^([^/]+)$ index.php?id=$1 [L,QSA] ...

Configuring Blogs on a multi site Magento setup

apache,.htaccess,rewrite,server

Add the following to your root .htaccess: RewriteEngine on RewriteCond %{HTTP_HOST} ^(?:www\.)?(abc|pqr)\.com$ [NC] RewriteRule ^blog(?:/(.*))?$ /blogs/%1/$1 [NC,L] Please rearrange the end part of your .htaccess as #Redirect Blogs RewriteCond %{HTTP_HOST} ^(?:www\.)?(abc|pqr)\.com$ [NC] RewriteRule ^blog(?:/(.*))?$ /blogs/%1/$1 [NC,L] ############################################ ## rewrite everything else to index.php ## but never rewrite for existing files,...

RewriteRule with multiple params?

.htaccess,url-rewriting,rewrite

You have to use the [QSA] flag at the end of your rewrite. QSA stands for Query String Append. You also had a typo at the end of your rewrite, where you wrote &3 instead of $3: RewriteRule ^sitemap-([a-z]+)-([0-9]+)-([0-9]+).xml$ sitemap.php?category=$1&month=$2&date=$3 [L,QSA] ...

Rewrite rule for mod_rewrite with query ID

regex,apache,mod-rewrite,rewrite

Try the following: RewriteEngine On RewriteCond %{QUERY_STRING} confId=(\d+) RewriteRule ^/my(meeting|schedule)\.py /conf/event/%1? [R=302,L] ...

Redirect all urls ending in “/”

apache,.htaccess,mod-rewrite,seo,rewrite

You can use this rule in root .htaccess: RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.+?)/$ /$1 [NE,R=302,L] RewriteCond %{THE_REQUEST} \s/{2,}[?\s] RewriteRule ^$ / [R=302,L] ...

Redirect omitting parameters in .htaccess

apache,.htaccess,rewrite,server

To truncate a query string add a '?' sign to the end of target URLs like this: RewriteRule ^es/empresa/.*$ http://domain/nosotros.html? [R=301,NC,L] ...

Can not rewrite slash rule in htaccess

.htaccess,web,rewrite,slash

Use this .htaccess: RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^([^.]+)/?$ $1.html [NC,L] ...

Unicode Characters in htaccess rewrite

php,.htaccess,unicode,rewrite

When the URI is used to match against a rewrite rule's regex pattern, it is first decoded, so those % and hex values get turned into unicode. Your regex pattern [A-Za-z0-9-]+ won't match unicode. Try changing your second rule so that it matches anything that isn't / instead: RewriteEngine on...

Need a specific URL RewriteRule in .htaccess

regex,apache,.htaccess,mod-rewrite,rewrite

This rule is the problem: RewriteRule ^somepage/(.*)$ /somepage [R=301] for two reasons: Since you don't want URL to change you must not use R=301 flag in this rule. Bigger problem is that your regex ^somepage/(.*)$ will also also match /somepage/ and you needed to match /somepage/something. To fix this issue...

AngularJS SEO htaccess: redirect root domain to snapshot

angularjs,.htaccess,redirect,seo,rewrite

Have you tried adding a specific rule for that? RewriteCond %{QUERY_STRING} ^_escaped_fragment_= RewriteCond %{HTTP_HOST} ^touchtyping.guru [NC] RewriteRule ^$ snapshots/index-en.html [L] EDIT: Try re-arranging your rules a bit: RewriteEngine on # Redirect http://www. to just http:// RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC] RewriteRule ^(.*)$ http://%1/$1 [R=301,L] RewriteCond %{QUERY_STRING} ^_escaped_fragment_= RewriteCond %{HTTP_HOST} ^touchtyping.guru [NC]...

Windows Azure: redirect website from www to non-www

redirect,azure,iis,web-config,rewrite

You can have it this way (i've merge https/non-www rules in one rule) <rule name="HTTPS and non-WWW only" stopProcessing="true"> <match url="^(.*)$" /> <conditions logicalGrouping="MatchAny"> <add input="{HTTPS}" pattern="off" ignoreCase="true" /> <add input="{HTTP_HOST}" pattern="^www\." ignoreCase="true" /> </conditions> <action type="Redirect" redirectType="Found" url="https://example.com/{R:1}" /> </rule> <rule name="Generic default rule" stopProcessing="true"> <match url="^(.*)$"...

nginx rewrite rule php melody

.htaccess,nginx,url-rewriting,rewrite

The curly brackets {9}are most likely giving a problem in your regex. Surround the rule with quotes like below and try it. rewrite "^/([^/]*)_([a-zA-Z0-9]{9}).html$" /watch.php?vid=$2 last; Note: for curly braces( { and } ), as they are used both in regexes and for block control, to avoid conflicts, regexes with...

Third party helper override doesn't work

magento,rewrite,override,magento-1.7,helper

What you've written looks correct... is something else rewriting it perhaps? Add a _construct() method to Ess_M2ePro_Helper_Module_Renderer_Description with die(get_class($this)); and see what the class name is. If it is something else, you have some more work to do (which I can help with if need be), otherwise if it is...

htaccess rewriteRule in localhost

.htaccess,mod-rewrite,rewrite

You can use this code in your DOCUMENT_ROOT/.htaccess file: RewriteEngine On RewriteBase / # If the request is not for a valid directory RewriteCond %{REQUEST_FILENAME} !-d # If the request is not for a valid file RewriteCond %{REQUEST_FILENAME} !-f RewriteRule !^taha/FrontEnd/ taha/FrontEnd%{REQUEST_URI} [L,NC] ...

301 Redirect On Root Query Params

.htaccess,mod-rewrite,redirect,rewrite,http-status-code-301

Try these 2 rules as your very first rules just below RewriteEngine line. RewriteEngine On RewriteCond %{QUERY_STRING} ^from=TEST_1$ RewriteRule ^/?$ /foo? [L,R=301] RewriteCond %{QUERY_STRING} ^from=TEST_2$ RewriteRule ^/?$ /bar? [L,R=301] ? at the end of target URI is used to discard previous query string from target. ^/?$ is the regex to...

htaccess - redirect multiples files into subfolders to parent folder

php,.htaccess,redirect,rewrite

You would likely need a different rule for each of the 3 possible digits in modXXX because you can't really string pad with regular expressions. Something like this might work, but I haven't tested it: #match 1 digit RewriteCond %{REQUEST_FILENAME} !-f RewriteRule (m([0-9])_.*\.php) view/mod00$2/$1 [QSA,L] #match 2 digits RewriteCond %{REQUEST_FILENAME}...

htacces rewrite single file

.htaccess,file,rewrite

RewriteRule does not receive leading slash. Write so: RewriteRule ^file.html$ /dir/file.html [L] ...

redirect WP post from one subdomain to WP page on domain subdirectory using htaccess- file

wordpress,.htaccess,rewrite,subdomain,subdirectory

Add the following HTTP_HOST rule just before your wordpress rules. RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} ^sub\.domain\.com$ [NC] RewriteRule ^postname/?$ http://domain.com/pagename [R=301,NC,L] RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] To redirect sub.domain.com to domain.com/subdir, you would use RewriteCond %{HTTP_HOST} ^sub\.domain\.com$ [NC] RewriteRule ^(.*)$...

Rewrite running total sql query

sql,oracle,rewrite

Updated answer Query with data grouping at beginning and sorting rows with row_number. I think it may be better if after grouping you have much less rows. Tried it against 750,000 rows, new version was faster. But I prefer your query, it's more readable ;-) with ds as (select dept_id,...

RewriteRule : How can i handle my url

php,.htaccess,mod-rewrite,redirect,rewrite

Try this in Root/.htaccess : RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)/?$ /404.php?url=$1 [R,QSA,L] ...

Apache translate simple rewrite rule to plain english

php,apache,.htaccess,rewrite

Rule & condition interpretations: Your first 2 statements are correct Statement 3 is almost correct: any query string ( This is the part after the ? ) in the original url will be appended to index.php?path=<path>. Flag ( these are the codes in brackets ) breakdown in a nutshell:...

nginx limit_req does not work

nginx,webserver,rewrite,rate

The problem is that nginx process request in several phases and rewrite phase goes before preaccess one (this is where limit_req is applied). So in you config requests are rewritten to /pages/... before they had a chance to be limited. To avoid this you either should stay in the same...

Silverstripe hash link rewriting putting unwanted slash in link

hash,hyperlink,rewrite,anchor,silverstripe

In your DataObject's getLink() method you can simply remove the trailing slash using rtrim: public function getLink() { //remove trailing slash from parent link $parentLink = rtrim($this->ParentPage()->Link(), '/'); return $parentLink . '#' . $this->URLSegment; } Now in your template just run in DataObject's scope: <a href="$Link">Link</a> Though i didn't notice...

wordpress subdomain errors (2 wordpress)

wordpress,.htaccess,mod-rewrite,rewrite,subdomain

Change both the config variables to use subdomains. define( 'WP_HOME', 'http://subdomain.domain.com' ); define( 'WP_SITEURL', 'http://subdomain.domain.com' ); This puts your .htaccess in full control and prevents wordpress from appending /subdomain anywhere....

iOS rewriting image file at specific path shows old image

ios,file,swift,uiimage,rewrite

You're running into a couple of different problems, the biggest of which is that UIImage.imageNamed specifically caches the image read, so changing the underlying file won't result in the new image being used. The other (related) issue is that imageNamed is primarily intended to load static images out of the...