Posts

Showing posts with the label url-rewriting

ASP.Net Meta Tags: Programmatically populate Title, Keywords and Description in Page Head Section from database

Image
ASP.Net Meta Tags: Programmatically populate Title, Keywords and Description in Page Head Section from database I'm trying to create search option in my ASP.net application to check Doctor details based on Location. If I try the below code, only home page is showing. http://example.com/Metatag/Home.aspx . I want the URL to be changed as per location. Example expected URL: http://example.com/Metatag/chennai/doctors/saidapet http://example.com/Metatag/Home.aspx http://example.com/Metatag/chennai/doctors/saidapet I'm new to this technology. Page Load protected void Page_Load(object sender, EventArgs e) { string page = Request.Url.Segments[Request.Url.Segments.Length - 1]; string location = Request.Url.Segments[Request.Url.Segments.Length - 1]; DataTable dtMeta = this.GetData(page,location); //Add Page Title this.Page.Title = dtMeta.Rows[0]["Title"].ToString(); //Add Keywords Meta Tag HtmlMeta keywords = new HtmlMeta(); keywords.Ht...

rewrite subfolder doesn't work

rewrite subfolder doesn't work Following rule doesn't work for subfolder rewriting. RewriteRule ^cat/([0-9a-zA-Z]+) cat.php?id=$1 RewriteRule ^cat/([0-9a-zA-Z]+)/([0-9a-zA-Z]+) cat.php?id=$1&sid=$2 For example With this rule <?php $id='News'; $sid='Politics'; ?> <a href="cat/<?php echo $id?>/<?php echo $sid?>">..</a> In next page, while echoing $_GET['sid'] , it doesn't work $_GET['sid'] Notice: Undefined index: sid in ... But this rule RewriteRule ^cat/([0-9a-zA-Z]+)/([0-9a-zA-Z]+) cat.php?id=$1&sid=$2 works, if only there is two querystring parameters <a href="cat/<?php echo $id?>/<?php echo $sid?>">..</a> but it generate ERROR 500 if there is only one parameter ERROR 500 <a href="cat/<?php echo $id?>>..</a> 1 Answer 1 Try with below, R...

HAProxy and reqrep path rewriting with redirect configuration

HAProxy and reqrep path rewriting with redirect configuration With HA Proxy 1.5 I need to rewrite URL from http://main.domain.com/my-foo to http://othersite.com:8081/other-bar http://main.domain.com/my-foo http://othersite.com:8081/other-bar Here is what I tried: frontend ft_def bind :80 mode http acl has_special_uri path_beg /my-foo use_backend def if has_special_uri default_backend def backend def mode http option forwardfor reqirep ^([^ ]* )/my-foo(.*) 1/other-bar2 server myserver othersite.com:8081 This works: URL http://main.domain.com/my-foo/home.html becomes http://othersite.com:8081/other-bar/home.html http://main.domain.com/my-foo/home.html http://othersite.com:8081/other-bar/home.html and in the browser the initial URL http://main.domain.com/my-foo/home.html appears. http://main.domain.com/my-foo/home.html I...