Questions tagged [url-rewriting]

1

votes
3

answer
860

Views

WordPress: Why Isn't add_rewrite_rule Working?

Goal A visible URL of: /products/building-automation/details/productSKU Should point to the real WordPress page of: /products/details/?SKU=productSKU Code public function setup_frontend() { add_rewrite_rule( 'products/(building-automation|lighting-controls)/details/([^/]*)', 'products/details/?SKU=$...
Andy Mercer
1

votes
2

answer
188

Views

Redirect a 404 to another page and capturing the page with .htaccess

Alright, what I'm wanting to do is create a .htaccess that will redirect any 404 error to another page while capturing the path/file attempted to be accessed. So, if they are trying to access www.mydomain.com/xxx I want it to be redirected to www.mydomain.com/error.php?e=xxx. I've never been ove...
Kevin Lupo
1

votes
3

answer
9.9k

Views

CodeIgniter URL not found

enter code hereI got this code in my .htaccess file: RewriteEngine On RewriteBase /projFolder ### Canonicalize codeigniter URLs # If your default controller is something other than # 'welcome' you should probably change this RewriteRule ^(mycontrol(/index)?|index(\.php)?)/?$ / [L,R=301] RewriteRule...
Lachezar Raychev
0

votes
0

answer
2

Views

Azure - cheapest way to host Angular micro-apps that need url rewrites

I have a SPA that is made up of multiple micro-apps each built with angular. I would like to host on azure as a storage account as it’s all static files, however it requires some url rewrites for various routing reasons and there is no way to configure this in storage accounts. What options do I h...
ib4nez
1

votes
1

answer
113

Views

Apache: How can I both redirect foo.html to foo and rewrite foo to foo.html?

I'm hosting a website that's just a bunch of static .html files. I don't want to have the .html file extension in the URLs, so I've added a rewrite rule: RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}\.html -f RewriteRule ^(.+)$ /$1.html [L] This is simple enough and works fine,...
futlib
1

votes
1

answer
325

Views

Nginx url rewrite in two folders

In Apache I have a .htaccess file in the root to rewrite URL's with an exception to a folder called admin. In the admin folder I have another .htaccess file to rewrite URL's in that folder. How can I achieve the same using a nginx server block? This is the snippet I currently use for URL rewriting i...
Asa Carter
1

votes
2

answer
643

Views

Jetty Redirect HTTP to HTTPS using Rewrite

I have an embedded Jetty Server and I want to direct request from http://localhost:8080/ to https://localhost:4433/ how do I do that? I tried this: // Set up rewriting (HTTP -> HTTPS) RewriteHandler rewrite = new RewriteHandler(); RedirectPatternRule redirect = new RedirectPatternRule(); redirect.se...
Display
1

votes
3

answer
450

Views

Dynamic url change into seo friendly url

A very common problem, but couldn't fix the issue. I want http://website.de/page.php?module=helios into http://website.de/page/helios I have tried lots of .htaccess code like this one, but still page sends to 404. RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !...
Adas
1

votes
1

answer
105

Views

Remove these characters at the end of the url using .htaccess

http://www.example.com/marketplace/seller/profile/swamytiles?___ This is the URL. i want to remove those ?___ characters in the above url, using .htaccess url rewrite. I tried this Removing a trailing character at the end of a URL using htaccess. but it didn't help me. please someone guide me.
Vinay
1

votes
1

answer
629

Views

Rewrite Rules in separate config file

I am using URL rewriting in my application, I have two config file as given below, first one have configuration and second one have for Rules. but I am getting 404 Error. Web Config rewritemaps.config File Error Screenshot is here:
Aman
1

votes
1

answer
41

Views

Combining Rules in .htaccess file?

I'm wondering how to connect these two rewrite rules in one .htaccess file. Currently, I force https connections to my website with this rule: RewriteEngine On RewriteCond %{HTTPS} !=on RewriteCond %{ENV:HTTPS} !=on RewriteCond %{HTTP_HOST} !=SERVER_NAME RewriteRule .* https://%{SERVER_NAME}%{REQUE...
LuMa
1

votes
1

answer
48

Views

How to remove an element/parameter from URL by .htaccess

I would remove color_new=any-value-could-be-here anywhere in URL via .htaccess So how to do it?
Kevin Smith
1

votes
1

answer
30

Views

Nginx - Rewrite timestamped assets

I'm currently in the process of moving from Apache to Nginx and am having problems with one of the rewrite rules. I have the following rule in my old .htaccess: RewriteRule ^(.*)\.[\d]{10}\.(css|js)$ $1.$2 [L] How would I rewrite this rule for Nginx? Everything I try either doesn't work or simply pr...
Basaa
1

votes
2

answer
53

Views

How to re-direct blog article URLs?

I am trying to redirect a bunch of old blog article URLs using the .htaccess file: RedirectMatch ^/index\.php/global/article/(.*)$ http://www.mywebsite.com/blog/article/$1 This doesn't really work, however, because my CMS seems to get confused by the index.php bit and keeps adding ?symphony-page= t...
Tintin81
1

votes
1

answer
38

Views

can't access specific link after mod_rewrite

Hello i did some mod_rewrite and now i have some problems accesing some links. To understand better i'll past here my mod_rewrite and the link i want to acces and i can't because it redirects me to the one i rewrited. The link i want to access is agro.websoftit.ro/admin/app/add_categoie.php and her...
chris227
1

votes
2

answer
5.7k

Views

Nginx rewrite rule (with try_files?) filename.php?text=$args (to) foldername/?text=$args

How can I rewrite rule in nginx for the case, when I send parameters with this request example.com/index.php?text=s1&sort=s2, but I want nginx to process it as example.com/process/?text=s1&sort=s2 ? 's1' and 's2' is something that you type in search form. I've already tried this: rewrite ^/index.php...
Oria
1

votes
1

answer
23

Views

.htaccess 301 redirect: redirect url via string

After a Joomla site upgrade I need to redirect every url which contains a string to another url. It is a Joomla site which ran SOBI2 and a few other components so the url could be: ?option=com_sobi2&sobi2Task=sobi2Details&sobi2Id=101748&lang=de I tried the following for SOBI in the .htaccess with no...
2

votes
1

answer
85

Views

Two WordPress Multisite installation in different subdirectories

I have a WordPress Multisite installation here: mydomain.com I use it to have different languages like: mydomain.com/fr mydomain.com/de ... Now we are changing design, but we would like to do step by step, language by language. So we have installed another Wordpress Multisite in the folder /new, tha...
FlamingMoe
1

votes
2

answer
552

Views

.htaccess: Redirect removing file extensions unless part of a query string

Many answers here come close but none are complete. I would like .htaccess to redirect and remove php/html extensions and trailing slashes so all files, directories, and bootstraps look the same. The problem is that a URL might, or might not, include a query string with an external URL link which th...
Gregor Macgregor
1

votes
1

answer
35

Views

htaccess SEF URL rewriting not working with question mark

Please I'm facing some challenges with my URL rewriting. I'm trying to rewrite: domian.com?v=subj to domian.com/subj and domian.com?v=subj&id=3 to domian.com/subj/id So users can directly access a clean URL. Here's what I tried that wasn't working: RewriteCond %{QUERY_STRING} ^v=(.*)$ RewriteRule ^...
samson ade
1

votes
2

answer
65

Views

.htaccess rewrite rule not working

I've been looking few different tutorials about it like https://www.addedbytes.com/articles/for-beginners/url-rewriting-for-beginners/ and I thought it would be easy to do my own rewrite rule but I don't know why it's not working. this is what I have in my htaccess # BEGIN WordPress RewriteEngine O...
Alex
1

votes
1

answer
20

Views

How To Create Apache Mod Rewrite Rules With Querystring

I've looked though the similar Rewrite questions like Need help with Apache Rewrite issues but, it is not doing what I need in my scenario. I think I am close, just can't quite finish The current URL: www.OldStore.com/some/series/of/uri The NEW URL that I want: www.NewStore.com/catalog/some/series/o...
Jeff
1

votes
1

answer
463

Views

Static content is not loading with sub url with Nginx Server Try files

I have new to Nginx server. I have site with url and I am using try_file with Ngnix server configuration. These are some url: http://localhost:81/test-url http://localhost:81/test-url/abc If am try to fetch this url http://localhost:81/test-url then it work fine and all css will be loaded fine.But w...
Charnjeet Singh
1

votes
1

answer
199

Views

.htaccess RewriteRule Automatically URL

Well i got this code at my .htaccess RewriteRule page/(.*) ?page=$1 RewriteRule search/(.*) search.php?search=$1 RewriteRule post/(.*) post.php?id_post=$1 And it works but i need to change manually the url. And i have alots of pages to change it. Theres any other way to put code at .htaccess and mak...
luckr
1

votes
2

answer
34

Views

How do I reconnect HTTP to HTTPS with subdomain?

I have the following HTTP address: http://www.example.com/ but my HTTPS address has a subdomain and no www, like this: https://secure.example.com/ I tried the following rule: RewriteEngine On RewriteCond %{HTTPS} off RewriteRule ^(.*)$ https://secure.%{HTTP_HOST}%{REQUEST_URI} [L,R=301] Which sent m...
Daan
1

votes
1

answer
103

Views

.htaccess clean url with two variables

Well i already tried many codes but still cant figured it out whats the correct one to make it working. Well i got this code: #--Redirect from '/?page=foo' to '/page/foo'--# RewriteCond %{THE_REQUEST} /\?page=([^\s]+) [NC] RewriteRule ^ /page/%1? [NC,L,R] #--Rewrite '/page/foo/' to '/?page=foo'--# R...
luckr
1

votes
1

answer
446

Views

i create a custom url in Codeigniter but post data can't show

i'm create a online shopping store with vendor system and i want every vendor profile show with his username in url. My current url show with id number like www.mydomain.com/home/profile/1 i want my my url show user name in url like: www.mydomain.com/username My Code is Here: Model //get all vendo...
Azhar Saleem
1

votes
1

answer
215

Views

add_rewrite_url get parameters are empty

I used add_rewrite_rule to redirect a nice URL to the right page. This is the rule: add_rewrite_rule('^([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)/?','index.php?pagename=auto&id=1234', 'top' ); So if I go to the following URL: website.com/cars/brand/model/car/1234 It wil go to the page with pagename aut...
Wouter den Ouden
1

votes
1

answer
346

Views

Removing .php extension in URLs except sub directory

Hello I used below code to remove extension .php from url in .htaccess index.php -------- index and it worked fine. Please assist me to stop this from removing the .php extension in sub directories eg: www.example.com/cp/index instead of: www.example.com/cp/index.php RewriteEngine On RewriteBase...
Hosam alzagh
1

votes
1

answer
21

Views

How can I get in one spesific folder?

I have made clean urls in .htaccess file, but after that I dont get Access to a spesific folder. How can I get Access to /folder/? .htaccess: Options +FollowSymLinks RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^([a-zA-Z0-9]+)$ index.php?side=...
nodde
1

votes
1

answer
920

Views

IIS rewrite - add '.html' to any URL's that don't have an extension

I'm trying to setup an IIS rewrite rule to add '.html' to URL's that don't have an extension, eg: Original URL: www.domain.com/page Rewrite to: www.domain.com/page.html And I want to ignore any URL's that have an extension (eg. if they are images or other files) Does anybody know the rule that I wou...
jk105
1

votes
1

answer
4.2k

Views

Nginx rewrite rules with query string arguments

Here are my nginx rewrite rules rewrite ^(.*)$ http://www.destination.com/main.php?utm_source=xxx&utm_medium=yyy&utm_campaign=zzz permanent; Everything works so far except when there's query arguments. This is a permanent 301 redirect, and I need to configure the case when there's query string, it w...
KDX
1

votes
1

answer
143

Views

How to use parse special characters literally in Apache rewrite rule?

So I have this Apache rewrite rule: RewriteRule ^news.php?viewStory=([0-9]+)$ index.php?page=news&viewStory=$1 It's needed as I'm changing the structure of a website, and I need to take into account the old structure. It all works correctly, apart from one thing. I need it to parse the ? character f...
user3420034
1

votes
2

answer
56

Views

Trying to create an htaccess file to handle both extensionless files and missing files

I am trying to combine two htaccess rewrite rules: one to handle extensionless links and the other to send missing files to an index page to handle them. I have working code for them separately but combining the two is tricky. The rules would be such: If the URI is a directory, go to it and let the...
Eddystone
1

votes
1

answer
308

Views

Nginx URL rewrite regex

I've switched over from Apache to Nginx. A very smooth and trouble free process, until I had to sort out a .htaccess file I have, and now I am stumped. I understand that Nginx does this differently and that this needs to be done in the config file (within a location /{code here} entry) using regex a...
1

votes
2

answer
152

Views

Regex rewrite rule for filename with dash

I got a filename like jquery.form.min.3.51.0-2014.06.20.js and want to change the following my rewrite rule to remove the dots, the dash and the digits. RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.+)\.(\d+)\.(js|css|png|jpg|gif)$ $1.$3 [L] The rewrite rule...
Albi
1

votes
2

answer
158

Views

URL rewriting with .htaccess and relative paths

I have a small problem with rewriting urls. I have this really simple rewrite rule: RewriteEngine on RewriteRule ^(home|apps|news|research|contribute)/$ index.php?page=$1 However, whenever I call my website like this, e.g. website.net/home/ it correctly rewrites the rule and shows the corresponding...
Sebastian Gabl
1

votes
3

answer
488

Views

Htaccess rule, convert dash to slash in url

I want to convert single (first) dash into slash. I have two urls here: Actuall url: http://localhost/wordpress/accessories-car-alarm-system. Should redirect to http://localhost/wordpress/accessories/car-alarm-system. I want to convert this specific url from first one to second one. I am using t...
Maha Dev
1

votes
2

answer
54

Views

Remove page + query string from URL

I have an old URL syntax and since I changed my CMS, the old syntax doesn't work anymore and I have a lot of error 404. I want to delete 'article.php?p=' here : http://www.example.com/article.php?p=name_of_my_page to : http://www.example.com/name_of_my_page How can I totally remove the string 'artic...
saiyuke
1

votes
1

answer
396

Views

htaccess redirect if does not start with folder

I would like to create a white list folder and redirect all others requests to index url.com/public/.*
zorx

View additional questions