FAQ Database Discussion Community


Friendly URL using .htaccess and PHP “include”

regex,apache,.htaccess,mod-rewrite,url-rewriting
I have very little experience with PHP and using .htaccess, though I would like to create SEO-friendly URLs. I have scoured the internet and Stackoverflow searching for a problem similar to mine. I have tried multiple solutions but have had no luck and I am constantly met with errors. So...

How to create a EXCEPT Rewrite Rule at IIS

web-services,iis,ssl,url-rewriting,windows2012
I have a IIS Site with Rewrite Rule to redirect all requests to https. I have a internal webservice which works with http but rewrite rule modify "http" request to a "https". When happens, webservice returns an error "Object Moved". I tried use "AllowAutoRedirect" with true value but it doesn't...

Difference between Require SSL and using URL Rewrite in IIS

iis,ssl,url-rewriting,iis-7.5,url-rewrite-module
Is there improved security with web applications if you use "Require SSL" in the SSL Setting section of IIS? I was planning on creating a URL Rewrite rule.

apache2 - https redirection to http for a given page

apache,.htaccess,mod-rewrite,url-rewriting,url-redirection
I have a specific problem about the redirection of HTTPS to HTTP for several pages. I have Apache2 in front of Zope 3 framework. Here's the configuration of my VirtualHost on port 80 : <VirtualHost *:80> ServerAdmin [email protected] ServerName website.com ServerAlias www.website.com <IfModule mod_rewrite.c> RewriteEngine On # www to non...

URL rewrite on IIS 8.0

iis,url-rewriting,iis-8,url-rewrite-module
I have installed URL rewrite module on the IIS 8.0 and configure rules If user come without www and it will prefix www If user comes from http then it will redirect to https If user comes from mobile browser than it sends to mobile website Below are the rules...

Regex for fixing URL patterns

asp.net,regex,url-rewriting
I have the following url structure: http://www.xyxyxyxyx.com/ShowProduct.aspx?ID=334 http://www.xyxyxyxyx.com/ShowProduct.aspx?ID=1094 and so on.. Recently I used IIS rewrite to rewrite this structure as http://www.xyxyxyxyx.com/productcategory/334/my-product-url http://www.xyxyxyxyx.com/productcategory/1094/some-other-product-url and so on.. This works fine. I want to create another rule so that if an invalid url requests comes with the following structure: http://www.xyxyxyxyx.com/productcategory/ShowProduct.aspx?ID=334 the 'productcategory'...

IIS Rewrite URL to remove duplicate query strings

iis,url-rewriting
Is it possible to rewrite/redirect a url such as this: http://example.com?id=123&id=123 To instead be: http://example.com?id=123 The actual reason for doing this is a bug in code, but a URL rewrite/redirect would be a quick workaround....

How to use Apaches RedirectMatch to force non www version of domain

apache,url-rewriting
I've only just discovered Apaches Redirect method as an alternative to using a .htaccess file in order to force a non www version of my domain. The problem is I need to ensure any inner pages redirect to the non www version properly as at the moment the simple Redirect...

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

.htaccess,mod-rewrite,url-rewriting,rewrite,file-extension
How can I group these two together; is it like ".(html|php)$" - please provide the code. Note, the answer should work for all file extensions: what is your thoughts on removing every file extension; comment on the code used - as it is rare to find. RewriteCond %{THE_REQUEST} ^GET\ (.*)\.html\...

Cannot access subpage url of subdomain

php,apache,.htaccess,mod-rewrite,url-rewriting
I did a rewrite rule for wildcard subdomain access to allow me to access any countries of my list page as follows: RewriteCond %{HTTP_HOST} ^(.+)\.mydomain\.net$ RewriteCond %{HTTP_HOST} !^www\.mydomain\.net$ RewriteCond %{REQUEST_URI} !^.*\.(jpe?g|png|gif|bmp)$ [NC] RewriteRule (.*) pages/list.php?country=%1 [L] This is working fine. Now. I do a rewrite rule to access another page...

how is youtube url constructed?

php,url,url-rewriting,youtube
I am wondering how the youtube url is constructed? for example https://www.youtube.com/watch?v=L7Jd910Bw84 how is the value L7Jd910Bw8 created, is it a hash value ? is there any PHP function to use for creating this kind of urls? how is it possible to make sure that the two diffrent objects dont...

Code Igniter SEO friendly URL rewriting

php,.htaccess,codeigniter,url-rewriting,seo
I'm facing issues while rewriting URLs in codeigniter framework. Here is my URL http://localhost/article/lg-watch-urbane-vs-moto-360-a-detailed-real-world-comparison/19 And I've a controller like this : class Article extends CI_Controller { function __construct() { $this->set_page_name( "View Article" ); } function index($perma_link="",$id="") { $this->response['article'] = $this->restutil->get("portal/articles/get/".$id,array('id'=>$id))->article; $this->render_view('articles/view'); } } And my .htaccess is like this:...

.htaccess: rewrite url from domain_a.com/#something to domain_b.com/#something without changing visible url

apache,.htaccess,mod-rewrite,url-rewriting
I'm trying to rewrite URLs from domain_a.de to domain_b.de/$1 More specifically, I want the browser to keep showing domain_a plus keep hash tags after the domain itself: e.g. domain_a.de/#events ---> domain_b.de/#events I'm trying the following code: <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{HTTP_HOST} ^domain_a.de/$1 RewriteRule ^(.*) http://domain_b.de/$1 [P] </IfModule> I thought...

Why not use the dot (“.”) in url rewrite?

php,mod-rewrite,url-rewriting,php-standalone-server
I noticed that most PHP frameworks routes (all) does not use the written urls dot and the php-standalone-server also does not use dots (note that the php-standalone-server not need mod_rewrite, it usually works). This is a pattern, I avoid dots rewritten urls? Consider reading the following topics before: If I...

.htaccess SEO Friendly URLs not working with two parameters

php,apache,.htaccess,mod-rewrite,url-rewriting
I am trying to create SEO friendly URLs for my site and I have come to problem that I can´t solve. I can´t figure out how to setup the rewrite rule so it will show for example like this www.mysite.com/shows/late-night and www.mysite.com/news/title-of-article. Here is my htaccess file: RewriteEngine on RewriteRule...

URL rewriting messes css/js up

.htaccess,mod-rewrite,url-rewriting
what I'm trying to achieve is domain.com/register/free that would be domain.com/register.php?type=free When I go go domain.com/register the page loads fine, but if I put the next /free part it cant find the css or js images etc. Not too sure where I have gone wrong but this is my .htaccess...

Regular expression to match pattern and any number.

regex,url-rewriting,qregularexpression
I have a URL pattern which can be my-domain.com/my-path/prod234728749.html I want to create a rule to match any URL combination with: "/my-path/prod" + anycombination-of-number + ".html" The combination can be a combination of different numbers of unknown length....

unable to escape “?” in the url rewriting in htaccess

php,apache,.htaccess,mod-rewrite,url-rewriting
I have URL as: spa-shop/admin/index?docid=abc ,For this URL i am using htacces Rewrite Rule. The rule is as follow: RewriteRule ^((?i)spa-shop)/(admin)/([a-zA-Z\?]*)$ spavendor/index.php?url=spaAdmin/$3 [L] In this the output which i am expecting is : spashop/index.php?url=spaAdmin/index?docid=abc , but I am getting the URl as: spashop/index.php?url=spaAdminShop/index. Please let me know what is the...

Particular URL redirect to http if request come from particular host

apache,http,mod-rewrite,ssl,url-rewriting
Web server is apache, ssl configured, listening on 443, All http requests will be redirected to https using rewrite rule Issues is all url's are serving through https, but we want to connect to the web server through http if the request is coming for particular url from particular host,...

How to rewrite example.com/catelogue.php?page=3&cat1=fruit&cat2=apple with .htaccess

php,apache,.htaccess,mod-rewrite,url-rewriting
Can anyone help me with .htaccess rewrite url, I am new to it and stuck with this below problem i have this urls http://example.com/catelogue.php?page=3 http://example.com/catelogue.php?page=3&cat1=fruit&cat2=apple and i want this to be http://example.com/catelogue http://example.com/catelogue/fruit/apple Below is my .htaccess file, but here the problem is I have achieved this (example.com/catelogue/fruit/apple) but I...

htaccess - rewriterule help needed

.htaccess,mod-rewrite,url-rewriting
I am having problem with my rewrite rules. I have some urls with variables which look like this: localhost/mysite/user.php?u=username. I want to convert them to this: localhost/mysite/user/username/ This is what I have tried RewriteRule ^user/([A-Za-z0-9-]+)/?$ /mysite/user.php?u=$1 [NC,L] # Handle user page requests but its not working :( /mysite/user.php is in...

Page doesn't load after .htaccess redirect with parameters

php,.htaccess,url-rewriting
I recently hosted my website on 000webhost.com and once I hosted it, I logged in to check its working. When I click on a link such as message or profile that contains three parameters such as url, id and ref, the page gets redirected but the profile/message page doesn't load....

htaccess rewrite not taking away www

php,apache,.htaccess,mod-rewrite,url-rewriting
I have an .htaccess file that I want to do two simple things. I want all of my pages to show up as https (this is working fine). When someone goes to my site, no matter how they type in my site address, I want it to come up as...

Exclude a deep subdirectory from an .htaccess RedirectMatch

apache,.htaccess,mod-rewrite,url-rewriting
The site's .htaccess file has this existing command: RedirectMatch 404 /directory(/|$) An exception is required to make files from one deep subdirectory accessible while still returning a 404 for all other files under directory. The path to the accessible directory is: /directory/sub/sub/sub/sub If I comment out the existing RedirectMatch, the...

IIS 7.0 URL REWRITE

asp.net,iis,url-rewriting,web-config
I am setting up a redirect to WWW for one of our sites in the web.config and ran into a small issue. The code I have in the web.config for the rewrite is as follows : <rewrite> <rules> <rule name="Redirect to www" patternSyntax="Wildcard" stopProcessing="true"> <match url="*" /> <conditions> <add input="{HTTP_HOST}"...

URL rewrite rules with Apache

apache,.htaccess,mod-rewrite,url-rewriting
I have a .htaccess file like this: RewriteEngine On RewriteRule ^([\w-]+)/([\w-]+)/?$ profile.php?username=$1&w=$2 [QSA,L] RewriteRule ^([\w-]+)/?$ profile.php?username=$1 [QSA,L] RewriteRule ^p/timeline timeline.php [NC,L] RewriteRule ^p/notifications notifications.php [NC,L] I can use my url like this www.mysite.com/username or www.mysite.com/username/photos But some rules does not work. For example: www.mysite.com/p/timeline There is a problem with url...

need help. rewriterule not working with /?

.htaccess,mod-rewrite,url-rewriting
My URL is http://example.com/?aff_id=username and I want it like http://example.com/?ap_id=username I have tried all possible ways but no luck. If I removed ? (question mark) it works but I want ? in my URL. I know it is a regular expression so I tried to escape it but no luck....

Editing via function call PHP

php,url-rewriting,function-calls
I am wrapping functions in php pages in the functions.php and to access these pages, i put an action and a value in the url. I also have a function_calls.php which requests the action and its value and passes it to a switch case which calls the appropriate function. The...

I want to rewrite URL by .htaccess in php http://www.website.com/picture.php?id=12 to http://www.website.com/picture/id/12

.htaccess,url-rewriting
I want to rewrite URL. my code is not proper work my code is RewriteEngine on RewriteRule ^/?abc/([0-9]+)$ /http://www.kunxitelab.com/picture.php?id=$1 ...

IIS Url Rewrite rule HTTP to HTTPS AND add WWW

c#,.net,iis,url-rewriting,web-config
I have a website that I want to be only used with the WWW sub-domain and via HTTPS. I had an URL rewrite working for adding WWW. But now I also want to force a HTTP to HTTPS redirect. Just forcing HTTPS works as well, but when I can't really...

.htacces rewrite by cookie value

apache,.htaccess,mod-rewrite,cookies,url-rewriting
I have a website in 2 languages. I'm inserting the text for each language through php constants and I define the user language through a cookie (lang=es or lang=en). Now the base url in each language is www.webname.com/ but i want to rewrite it depending on the language. If the...

IIRF url rewriting with IIS 6

php,url-rewriting,iis-6,iirf
I want to rewrite this url: "www.mydomain.com/myproject/index.php?function=demo" to 'www.mydomain.com/myproject/home/demo' and I have this code in my iirf.ini file: RewriteEngine on StatusInquiry On /iirfSatus RewriteLog c:\Inetpub\ RewriteLogLevel 3 RewriteBase / RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^/myproject/home/(.*)$ /myproject/index.php?function=$1 [L] I still get a 404 error when I surf to the...

URL rewriting - Add default page to domain

asp.net-mvc,url,url-rewriting,url-rewrite-module
I want to add defined Controller and Action to basic URL localhost:6473 -> localhost:6473/Beta/Index with the URL rewriting in Web.config but in some reason it doesn't work <rewrite> <rules> <rule name="Beta_Local" stopProcessing="true"> <match url="(localhost*)" ignoreCase="true" /> <conditions> <add input="{HTTP_HOST}" pattern= "^localhost:[0-9]{4}$" negate="true"/> </conditions> <action type="Redirect" url="{R:0}/Beta/Index" redirectType="Permanent" /> </rule> </rules>...

Regex not matching the first occurence of my string

regex,.htaccess,url-rewriting
In this url: http://example.com/SearchResult-Empty.html?caty[]=12345&caty[]=45678 I am trying to use the following regex to grab the first occurence of caty which should be "12345". However, instead, the regex below is giving me the final occurrence 45678. I tried using the "?" limiter to make it non-greedy per other stack overflow questions,...

How to remove the word 'index' in the url [.htaccess]?

.htaccess,mod-rewrite,redirect,url-rewriting,file-extension
Currently, I am using the below code to remove the word 'index' in my urls - however, the issue is that it allows for two versions: one without and one with [the word] - hence, I have referenced the one without (in the HTML) - but the user still might...

Targeting tabs on page with direct URL link breaks URL on tab click

javascript,jquery,hash,url-rewriting,tabs
I'm trying to create a tabbed area within my page. The tabs navigate hidden areas with out leaving the page. I also want to be able to link to an area with in the page. It's working except when you click the menu as well as revealing the hidden area...

Manually mod_rewrite each page

php,apache,.htaccess,mod-rewrite,url-rewriting
I tried everything on this world to make it work properly but it simply won't. I'm done with auto rewrite. You can still answer if you think you know what could be causing this but I doubt it's possible. Question: How would I go on manually mod_rewrite each page like...

# tag Not rewrite in htaccess file

php,regex,.htaccess,url,url-rewriting
i am facing problem with # tag in .htaccess file.. problem is http://localhost/query/index.php?string=abc%23123 here we encode query string by urlencode() method. actual value is abc#123 but its creating a problem on $_REQUEST[] method.. so some one suggest me to use urlencode(). I used it by accepted the suggestion. But now...

How to use multiple RewriteRules for use 3rdparty and routes at the same time?

php,apache,.htaccess,mod-rewrite,url-rewriting
The answers present in Redirect requests only if the file is not found? don't solve to the specific situation, for a defined real path and are routes (which will use PATH_INFO). I have a .htaccess to add path_info in the index.php file: RewriteEngine On RewriteCond %(REQUEST_FILENAME) !-f RewriteCond %(REQUEST_FILENAME)...

htaccess redirect non-image resources

.htaccess,mod-rewrite,url-rewriting
I have a website somedomain.com, and a CDN set up to the subdomain www.somedomain.com. (I would have liked to make it cdn.somedomain.com, but did not have the option). The CDN is effectively a dumb mirror. I want to use it to deliver image assets, but NOT pages. These .htaccess rule...

URL Rewrite rules appear to be redirecting instead of rewriting

iis,url-rewriting,url-redirection,url-rewrite-module
I am using IIS URL Rewrite 2.0 module to create a URL that always points to the latest version of my app. I have configured it as follows: <rule name="Latest" stopProcessing="true"> <match url="^latest(.*)" /> <action type="Rewrite" url="1.1{R:1}" /> </rule> The intention is that if something goes to /latest/* then all...

Tapestry5 : URL Re-writing : Pass parameters to transformPageRenderLink method

java,url-rewriting,tapestry
I am upgrading tapestry from 5.2.4 to 5.3.8 and am stuck at re-implementing the URL re-writing part. In my application a user account can have multiple data stores. User can have same page of different stores active at the same time. Hence I need to put the storeId in page...

Rewrite an URL without 302 redirect

.htaccess,codeigniter,mod-rewrite,url-rewriting
I would like to know, how can i rewrite an URL without the 302 redirection. The website is targeted by 2 domains. The first domains (domain1.com) focus all the website. The second domains (domain2.com) focus only one function to do an url shortener Here is my .htaccess : Options +FollowSymlinks...

Replace a word using IIS URL Rewrite

iis,url-rewriting
I am using the IIS Rewrite module with my web.config, and would like to rewrite certain requests by replacing a word in the URL. Example: http://domain.com/windows to be http://domain.com/WINDOWSSoftware I'm aware that a URL with query string parameters can be rewritten using for example below rule <rules> <rule name="Rewrite to...

.htaccess rewrite space to dash(-)

php,apache,.htaccess,mod-rewrite,url-rewriting
I got a dynamic URL I want to rewrite. I want to rewrite the space into a dash to not get %20 in the URL. My attempt was to create two parts in the .htaccess and put a @ sign in the middle of it when its sending the paranmeters...

Overview of how to rewrite a URL for dynamically generated page?

c#,asp.net-mvc,url-rewriting
I am in the process of writing my own blog system as a practice exercise and I ran into a question that I'm having a hard time finding an answer for. What are the steps necessary to define and implement a custom URL for dynamically generated page? I'm really only...

Why same .htaccess commands working differently in localhost and server?

php,apache,.htaccess,url-rewriting
I have the following .htaccess command for redirection of php pages RewriteRule ^(.*)$ index.php/$1 [L] This code is working in localhost.It is not working in web server. But when code is slightly modified it works in server. RewriteRule ^(.*)$ index.php?/$1 [L] Why is this happening?...

rewrite rule with regex to add forward slash

regex,apache,.htaccess,mod-rewrite,url-rewriting
I would like to know how can I turn this url : https://www.mywebsite.com/online/param1/param2 Into https://www.mywebsite.com//online/param1/param2 Or into https://www.mywebsite.com/en/online/param1/param2 Thanks everyone !...

My domain www.digitalproductshopping.com is on a WordPress installation, Can I add a sub-directory that is html5

html5,wordpress,url-rewriting,url-routing
Can I have a HTML5 Sub Directory as part of my WordPress installation. I have put the subdirectory in public.html folder, but when i enter the URL www.digitalproductshopping.com/affiliatemoneysecret, I get a page not found 404 error on this URL.

IIS URL rewrite rule using conditions

asp.net,regex,iis,url-rewriting,web-config
I have the following URL rewrite rule configured in my web.config file: <rule name="Test Rule" stopProcessing="true"> <match url="^$" /> <conditions> <add input="{QUERY_STRING}" pattern="^(item=1|all|none|first).*$" /> </conditions> <action type="Rewrite" url="/newsite/test.asp?{C:0}" /> </rule> The following source url matches as expected. http://domainname?item=1&param1=x%param2=y However the rewritten url includes param1 and param2 in its query string....

htaccess to rewrite uri into get if not file/folder

apache,.htaccess,url-rewriting
I need htaccess rule that rewrites an uri into get variable if it is not for an existing file or folder. Example: www.example.com/page1.php -> goto page1.php www.example.com/page2.html -> goto page2.html www.example.com/folder -> goto /folder www.example.com/some_string_value -> rewrite as /default.php?value=some_string_value ...

Two websites in same ASP.NET solution

asp.net,angularjs,iis,url-rewriting
I have two websites (index.html files) in the same asp.net solution. I have two domains that I want to direct to the correct html file. This is an angularjs application so I have only one html file per site. I want all requests for any resources at http://site1.myhostname.com/ to return...

Dynamic URL variable for SEO with Meteor

meteor,url-rewriting,seo,iron-router
I'm working on a Meteor app which uses ms-seo package. I was wondering if there is a way to make URLs more SEO friendly? Router.route('/item/:_id', { name: 'item.detail', controller: 'ItemsController', action: 'detail', where: 'client', onAfterAction: function() { var data = this.data(); if (data) { SEO.set({ title: data.title + ' -...

htaccess - Rewrite URLs with query parameter

regex,apache,.htaccess,mod-rewrite,url-rewriting
I have the following rule to rewrite URLs which works for single word parameters. However, it doesn't work if there is a "-" in the variable. How can I modify this to accomplish this? Old URL: domain.com/medications/?drug=medication-title New URL: domain.com/medications/medication-title RewriteRule ^medications/([^/d]+)/?$ medications/?drug=$1 [QSA] Like I said, it works when...

IIS: Use Application Request Routing for URL Rewrite outside of Default Website

iis,url-rewriting
I'd like to do a URL rewrite in IIS where subdomain is rewritten. For example: www.mycompany.com/api/v1.0 gets rewritten to api1.mycompany.com www.mycompany.com/api/v2.0 gets rewritten to api2.mycompany.com Note that I'd like to rewrite and not redirect, in other words, the URL in the browser remains www.mycompany.com/api/v1.0 and www.mycompany.com/api/v2.0. Any request that doesn't...

htaccess use flag N for next condition

.htaccess,mod-rewrite,url-rewriting
Some searchengines have listed urls in their index with two errors in it. I want to redirect them to the correct location. My problem is, I want to combine two RewriteRules, so it comes only to one single redirect-request. The misspelled Request-path looks like this: . /subdir/ page.php?id=0 & amp;...

IIS rewrite rule to redirect https to http not working

asp.net,iis,url-rewriting,web-config
There's lots of questions here about redirecting http to https so I figured it would be easy to reverse the process. However, everything I've tried hasn't worked. I'm trying to combine the rule with my canonical host name rule (it's the first rule, at the top of the rewrite rules):...

500 Error when '/' in url with url rewriting

.htaccess,url-rewriting,http-status-code-500
I have this .htacess on my server to redirect example/test -> example/test.php. ErrorDocument 404 http://rafflehaven.net/404 RewriteEngine on RewriteCond %{REQUEST_FILENAME}.php -f RewriteRule ^(.*)$ $1.php [L] RewriteCond %{REQUEST_FILENAME}.html -f RewriteRule ^(.*)$ $1.html [L] It works for basic url but when I request "example/fakefolder/test" it return a 500 error. And i have nothing...

htaccess rewrite url parameter

php,apache,.htaccess,mod-rewrite,url-rewriting
I want to redirect http://localhost:8080/mypproject/?supplier=test123 to http://localhost:8080/myproject/?product_cat=test123 But I don't know how......

Hide a directory with htaccess

.htaccess,mod-rewrite,url-rewriting,pretty-urls
I'm trying to hide a directory users of url (ex.:): meusite.com.br/users/teste but so far not succeeded. Like that by accessing meusite.com.br/teste show the content inside the folder teste and, if accessed URL meusite.com.br/users/teste the /users/ were removed and only exhibited the meusite.com.br/teste. I've tried: RewriteCond %{REQUEST_URI} !^/users RewriteRule (.*) /users/$1...

Nginx Rewrite Not rewriting the url

nginx,url-rewriting
I have tried this for hours and can't seem to get it. I copied other examples and still can't get rewrite to work. I need my url on nginx to look like http://myurl.com/main/login, http://myurl.com/somethigelse/home, est. Any Help Appreciated. I'm new to nginx, seems a lot faster. My nginx rewrite looks...

PHP Url redirection on index.php

php,url-rewriting
I am self learning php and started some coding for a web portal. I would like to develop the portal with url that should look like index.php?page=dashboard. If i put the dashboard.php in browser, it should not be displayed. Queries that i have. 1.how to program to use pages like...

URL Rewrite Rule not working .htaccess

php,apache,.htaccess,mod-rewrite,url-rewriting
I am trying to Rewrite the URL using .htaccess file but it is not working. First I tried a lot on my localhost and then on my Live Server but it's not working.. I still get the original url.That is what I have.. Original URL:- http://test.1click.com.pk/specific_hall.php?hall_name=Shalimar+Hall&hall_id=1 I Want:- http://test.1click.com.pk/Shalimar+Hall.php My...

index.html change to index.xhtml

jsf-2,url-rewriting
When trying to logout my application I'm having the following error message : com.sun.faces.context.FacesFileNotFoundException: /index.xhtml Not Found in ExternalContext as a Resource To logout I'm going though the following steps inside PhaseListener.beforePhase(PhaseEvent phaseEvent) : // Redirect to index.html NavigationHandler nh = fctx.getApplication().getNavigationHandler(); String action_outcome = "/index.html"; nh.handleNavigation(fctx, null, action_outcome); My...

Form Data Not Posting While Using URL Rewrite

asp.net,forms,url-rewriting,asp-classic,web-config
OK. Where to start.... I have a website. It is running on an IIS server using classic asp. I have forms on that website. The forms were working fine until I decided to add some url rewrite rules to my web.config file to redirect nice looking urls. After doing that,...

How to remove the parameters in url Java

java,jsp,url-rewriting,hide
I have a URL when I run my project. http://localhost:8084/blog1_1/title?uname=55%22 and I want remove the query string from this URL like below: http://localhost:8084/blog1_1/title Can you please suggest me how to do this?...

Rewrite url not working in htaccess

php,apache,.htaccess,mod-rewrite,url-rewriting
I have website. I just want to rewrite url using .htaccess Here is the code which I want to rewrite: RewriteEngine On RewriteBase / RewriteCond %{QUERY_STRING} /search_data.php\?keywords=([^&]+)&f=([^\s&]+) [NC] RewriteRule ^/search_data.php/?$ /search/%1/%2? [R=301,L,NC] this the current url http://localhost/mywbsite/search_data.php?keywords=one+piece&f=149 I want to convert this to this http://localhost/mywbsite/search/one-piece/149 I tried above code but...

WordPress - Rewrite rules with multiple parameters

regex,wordpress,url-rewriting
I'm setting up a WordPress page that would normally accept two querystring parameters. Our host prefers the use of rewrite rules instead of querystrings, so I have to take that approach. So where I'd normally do this: domain.com/animal-page.php?animal=dog&color=brown I have to do this: domain.com/animal-page/animal/dog/color/brown The problem I am running into...

rails 4 def to_param with 2 models

ruby-on-rails,url,ruby-on-rails-4,url-rewriting
I came accross something strange when trying to create friendly URLs. I have an item model which has: def to_param "#{id}-#{name}".parameterize end This makes my item URLs contain the "ID" and "name" just fine: www.domain.com/items/ID-name I also have a category model (item belongs to category and user models) where I...

htaccess url rewrite multple url

regex,apache,.htaccess,mod-rewrite,url-rewriting
I've a problem to rewrite url in my site with .htaccess index.php $op = $_GET['op']; switch ($op) { case "src": include("src.php"); break; case "dts": include ("dts.php"); break; default: include("home.php"); break; } Link to rewrite index.php?op=src index.php?op=dts&idric=20&sp=2 .htaccess Options +FollowSymLinks RewriteEngine on RewriteRule \.(css|jpe?g|gif|png|js|ico)$ - [L] RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}...

.htaccess URL-Rewrite solution?

apache,.htaccess,mod-rewrite,url-rewriting,rewrite
I need to rewrite my url using .htaccess The url is http://www.domain.com/subfolder/search-brands/index.php/?q=Garment Bags&brand=traveler apos s choice And i want it to work like this http://www.domain.com/subfolder/search-brands/Garment Bags/traveler apos s choice Anyone can make it? Thanks a lot for your help!...

Rewrite and combine query strings for wordpress

php,wordpress,plugins,url-rewriting
I'm working with two plugins with a different language query string setup. The language plugin itself works with mydomain.com/?lang=english (polylang plugin), the other plugin needs to retrieve mydomain.com/?language=english. How should I rewrite the url so both are working correctly? I've tried the following: function languagerewrite() { //$language = get_query_var('lang', 1);...

www Rewrite Rules for IIS Web.config Not Working

mod-rewrite,joomla,url-rewriting,iis-7,web-config
I have a rewrite rule in IIS that is supposed to rewrite inbound URL's without the 'www' to 'www'. The rewrite rule is in fact rewriting the URL to include the 'www', but it's directing the visitor to /index.php instead of sending them to the link they were trying to...

How to modrewrite in my subfolder

regex,apache,.htaccess,mod-rewrite,url-rewriting
I have a PHP script on a subfolder of my server and it generates url like this: http://example.com/subfolder//index.php?a=profile&u=username Instead I would like a SEO friendly url like: http://example.com/subfolder/profile/username.html I'm on Apache and mod_rewrite is enabled, so I edited the .htaccess of my subfolder page: RewriteEngine On RewriteRule ^([^/]*)/([^/]*)\.html$ //index.php?a=$1&u=$2 [L]...

.htaccess with two parameters redirects to a 404 page

apache,.htaccess,mod-rewrite,url-rewriting
I want to redirect /index.php?id=1&time=10 to /first-10. .htaccess: RewriteEngine On RewriteCond %{QUERY_STRING} id=1&time=10 RewriteRule ^index\.php$ /first-10/? [L,R=301] when I access /index.php?id=1&time=10 redirects to /first-10/, but it's a 404 page. Please notice last slash also. Where is the problem?...

“%” character causing issues in IIS URL rewrite regex

regex,asp.net-mvc,iis,url-rewriting
I'm replatforming an online shop, and part of that process is writing 301 redirects for old links customers may have bookmarked to hit their new addresses. All of them work apart from the ones in which the old address contains the % character. It seems to somehow be interfering with...

How to mod rewrite this URL correctly?

.htaccess,rest,mod-rewrite,url-rewriting
I am adding a REST API to my application. The REST API is located at /api of my app. I want to route all requests correctly including requests that have parameters. I have the following htaccess rules which are working for the most part: <IfModule mod_rewrite.c> Options +FollowSymLinks RewriteEngine On...

URL rewriting not doing what it's supposed to do, but code seems fine

php,.htaccess,url-rewriting
I've been working on a website for a friend lately, on which she can upload images of her paintings. Along with those images some information like size and techniques are entered. These images are added to an album which are then displayed in the gallery. The functionality is there, now...

angular module.run ReferenceError: $location is not defined

javascript,angularjs,url-rewriting
I want to AngularJS Change Path Without Reloading, look http://joelsaupe.com/programming/angularjs-change-path-without-reloading/ in core.js: 'use strict'; angular.module('App',['ngRoute']) .run(['$route', '$rootScope', '$location', function ($route, $rootScope, $location) { var original = $location.path; $location.path = function (path, reload) { if (reload === false) { var lastRoute = $route.current; var un = $rootScope.$on('$locationChangeSuccess', function () { $route.current...

How do i URL rewrite using .htacess

.htaccess,url,mod-rewrite,url-rewriting
i need some help rewriting URL using .htaccess my urls looks like: http://www.example.com/testro2/product.php?id=426834&productStore=396 And i need have it work with text into it, example: http://www.example.com/testro2/product/{anythinghere}/id=4268334&productStore=369 or you can make it look more clear like removing id= and &productStore= will be great, else i can use with them. example http://www.example.com/testro2/product/{anythinghere}/4268334/396 The...

use htaccess to redirect a range of urls which have parameters

.htaccess,mod-rewrite,redirect,parameters,url-rewriting
I had an email subscription for updates on my site, which I've temporarily disabled. I'm seeing hits to the site related to the subscription. The urls are very long but the first several characters are always the same. I've been trying to redirect these (at least for the time being)...

rewrite rule forward one url to another wordpress

regex,wordpress,.htaccess,mod-rewrite,url-rewriting
I'm using wordpress I would like to forward one url to another preferably via wordpress like add_rewrite_rule() but as I know it is not possible. (Because it will be much easier.) I have few cases that I want to match with same rule I would like to forward http://dom.com/sale/product to...

Issue with Similar Rewrite Rules in Web.config

asp.net,mod-rewrite,url-rewriting,web-config
I have a rule in my web.config that works. <rule name="Guestbook Rewrite" stopProcessing="true"> <match url="(.*?)-guestbook" /> <action type="Rewrite" url="guestbook.asp?gb={R:1}" /> </rule> When someone goes to MyDomain.com/view-guestbook or MyDomain.com/sign-guestbook they go to the appropriate pages. What I am having difficulty with is that I have several pages of guestbook entries, so...

Error 404 using RewriteRule in .htaccess

apache,.htaccess,url,web,url-rewriting
I am currently improving the usability of a website through friendly URLs. I have done this several times and what I typically do is hide the *.php or *.html extension using .htaccess following this code: RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^([^\.]+)$ $1.html [NC,L] However, this code seems to resist...

Magento - Catalog - No products show unless ? is used

php,magento,url-rewriting,catalog
Magento 1.9 I created a custom url rewrite. category/tripods => catalog/category/view/id/809 I have checked and both the above work the same. This is site wide, same with all category sections. When I enter my-site.com/category/tripods No products show, I do see the layered navigation / drilldown attributes and categories. When I...

multitwitch style url rewrite

php,.htaccess,url-rewriting
I'm trying to recreate the url rewriting that multitwitch.tv uses however am having issues in doing this as google is being unhelpful thinking I want to remove trailing slashes. I'm trying to effectively do this: site.com/aaa/bbb/ccc/ddd/eee site.com?aaa&bbb&ccc&ddd&eee Although multitwitch's source is public on Github it's python and not PHP with...

.htaccess add an extra word to add all my URLs

.htaccess,mod-rewrite,redirect,url-rewriting,litespeed
I need to a add a extra word right after my domain name to all my website URLs. Lets say my url is http://www.example.com/somecategory/someproduct.html, it should be http://www.example.com/logado/somecategory/someproduct.html. Is it possible to do it with .htaccess file ? If so what should i add to my .htaccess file ?...

HyperLinks not working (redirection while using pretty url with htaccess)

php,html,.htaccess,hyperlink,url-rewriting
Here is my php code(qs.php). This file contain pretty url links. <html> <head></head> <body> <?php $file = 'qs1'; //this is a php file qs1.php $id = '12345678'; //testing ID $complete_url = $file."/".$id; ?> <a href ="<?php echo $complete_url;?>"> This is a test link </a> </body></html> This link appear link this...

Rewrite different page with .htaccess url rewrite

.htaccess,url-rewriting
I'd like to use .htaccess for url rewrite. In my previous post you have shown me how to do it to the index.php page but now would like to do also for other pages like browser.error.php, etc. To do so I tried to add the last 2 rows in the...

How to short url address with .htaccess

.htaccess,url,url-rewriting
My code produce URL like this: http://domain.com/netRacuni/tcpdf/examples/pdf.php?key=bi5u3w2zys1v9sqijomsqyya5ge2v5 How I can make it like this: http://agroagro.com/bi5u3w2zys1v9sqijomsqyya5ge2v5 so only domain.com+key to be there?...

htaccess rewrite rule only partially works

php,apache,.htaccess,mod-rewrite,url-rewriting
I have a basic htaccess rewrite file, however I am unable to get one of the rules to work when it is similar to a previous rule. My code is; RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^gallery$ gallery.php RewriteRule ^about-us/page-1$ page-1.php RewriteRule ^about-us/page-2$ page-2.php RewriteRule ^about-us$ about-us.php...

htaccess URL Rewrite - Root to Subfolder (with folder of the same name)

regex,apache,.htaccess,mod-rewrite,url-rewriting
I have a file at www.domain.com/blog/blog.html that I want to rewrite as www.domain.com/blog. I have figured out the rewrite for removing the extension .html but am having either circular issues or end up pointing the blog rewrite to the blog folder when trying to do the above. I am new...

Redirect pages in Sub folder using .htaccess

.htaccess,url-rewriting
I have looked all over for the answer but can't seem to get any examples working so I need some help. I have a website built in PHP (Not using a framework). I have sub-pages in a folder called /some-work/ So the address to these sub pages is www.domain.co.uk/some-work/page I...

Using custom rewrite rules in Wordpress

php,wordpress,.htaccess,mod-rewrite,url-rewriting
I am trying to create custom rewrite rules in WordPress so that I can pass data to a page based on what is in the query string. My page works fine: /retailers-a-z/?merchant=some_merchant and then also /retailers-a-z/?merchant=some-merchant&offer=some-offer I first tried to create a rewrite rule for this in .htaccess but since...

What does the regular expression ^$ evaluate to?

regex,url-rewriting
I really haven't been able to figure out this regular expression. I do know that ^ means starts with $ means ends with But when you combine the two I really don't understand what would this evaluate to. Anyone? ...

Rewrite rules cause infinite redirect loop

apache,.htaccess,mod-rewrite,url-rewriting
My folder structure looks like this: /var/www/.htaccess /var/www/site/index.php /var/www/site/images/test.png Where the .htaccess file looks like this: RewriteEngine On RewriteCond /site/%{REQUEST_FILENAME} -f RewriteRule ^(.*)$ /site/%{REQUEST_FILENAME} [L] RewriteRule ^(.*)$ /site/index.php [L,QSA] Essentially, I want to rewrite all URLs to the /site/ directory, and have existing files simply rewrite to their paths in...

How to properly write a RewriteCond for https and subdomains

regex,apache,.htaccess,mod-rewrite,url-rewriting
Thus far I've gotten this far with my RewriteConditions but it's from hacking and slashing from internet examples. They seems to behave a little funny at times, like showing the directory in the url, so I assume I'm not doing it right. The desired behaviour: I have multiple subdomains all...

url rewrite using .htaccess to make friendly urls

php,apache,.htaccess,mod-rewrite,url-rewriting
i have 3 questions regarding .htaccess, 1- if i use .htaccess to rewrite the url's on my website does it affect any of the requests or do i need to change the link for all forms for example if a action post for a form is index.php?submit do i need...

WP - Adding Custom Rewrite Rule

wordpress,.htaccess,mod-rewrite,url-rewriting
I'm trying to add a custom rewrite rule for my WP site so http://example.com/?u=sample-output, is rewritten as http://example.com/sample-output. The rewrite rule I'm trying to add is: RewriteEngine On RewriteRule ^([^/]*)$ /?u=$1 [L] The existing rewrite rule is: RewriteEngine On RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule...

How do I create a rewrite rule only for certain requesting domains

php,apache,.htaccess,mod-rewrite,url-rewriting
I'm using a rewrite rule in my HTACCESS file that directs all images to a PHP file. RewriteRule \.(?:jpe?g|gif|png)$ adaptive-images.php This HTACCESS file sits on a domain I use as a CDN for my other domains. I only want the rule to apply when the images is requested by an...