url-rewriting

.htaccess rewrite: subdomain as GET parameter and filepath afterdomain intact

怎甘沉沦 提交于 2019-12-11 02:32:50
问题 I want to use htaccess to rewrite subdomains to a get paramater but keep everything after the domain intact + adding the parameter to the end or the url. Desired result: http://mpmain.example.com/ -> index.php http://www.example.com/ -> index.php http://hello.example.com/ -> index.php?subdomain=hello http://whatever.example.com/ -> index.php?subdomain=whatever http://whatever.example.com/index.php?page=login -> index.php?page=login&subdomain=whatever http://whatever.example.com/index.php?page

Why RewritePath changes the Browser Url?

走远了吗. 提交于 2019-12-11 02:32:50
问题 I have an ASP.NET 4 HttpModule (see code below). When the url path starts with "/1.0" I want Cassini/IIS to go to MyService.svc. However, I don't want to show "MyService.svc" to the user (i.e. no update to the url in the browser). I want the user to see "www.something.com/1.0". I was pretty sure that RewriteUrl isn't supposed to change the browser url, but in my case it does. Any idea why? public void Init(HttpApplication context) { context.BeginRequest += delegate { HttpContext ctx =

Apache Rewrite CLEAN url?

北慕城南 提交于 2019-12-11 02:29:54
问题 So I'm wondering if anyone would be willing to help me, or tell me if it's possible to do what I'm thinking of for my urls. So I want the urls to be like so http://www.example.com/(seriesname)/season/(seasonnumber)/episode/(episodenumber) The variables surrounded by '()' will need to be php variables that I can parse. Is this possible/any help on the regex for mod rewrite. And I could also go to lets say sub parts of the url to just show all episodes in a season or all seasons. EG: http://www

How can I stop .htaccess redirecting a subdomain to the main site?

馋奶兔 提交于 2019-12-11 02:16:08
问题 I have a .htaccess question. Basically my .htaccess is redirecting my newly created sub domain, to the main site, and I don't want it to do so. Let's assume my domain is called 'www.beans.com', and the subdomain is 'shop.beans.com', which is in the public_html folder under /shop/ . Here is the .htaccess: DirectoryIndex index.php enmain.php ErrorDocument 404 /404.html ## EXPIRES CACHING ## ExpiresActive On ExpiresByType image/jpg "access plus 1 week" ExpiresByType image/jpeg "access plus 1

Dynamic URL REWRITING for QueryStrings

痴心易碎 提交于 2019-12-11 02:14:03
问题 hello please help me for this question i have the following url --> www.sample.com/news.aspx?id=45 i want pass "id" in the query string to news.aspx and show this news, but due to url rewriting the url is changed to this --> www.sample.com/news/my-news-45/ How to extract "id" from the query string? Thanx for your help 回答1: you can manually done URL rewriting but The downside of manually writing code can be tedious and error prone. Rather than do it yourself, I'd recommend using one of the

How can I hide folder name from URL using .htaccess

╄→尐↘猪︶ㄣ 提交于 2019-12-11 02:07:36
问题 I have a website with the root folder 'www', but I put all php files including index.php in a sub-folder of root. I wrote myself a .htaccess file to redirect, so if I input www.test.com , it will jump to www.test.com/folder and display the index.php . Below it's my .htaccess which I put in the root. RewriteEngine On RewriteBase / RewriteRule ^folder2 - [L] #ignore folder2 in which I put important files, but no works for the website RewriteCond %{REQUEST_URI} !^/folder(.*) RewriteRule (.*)

Rewrite rule leads to 403 forbbiden error

℡╲_俬逩灬. 提交于 2019-12-11 02:06:33
问题 I have asked a question here yesterday and user "faa" tried to help me, but unfortunately we couldn't solve the issue. Original question is here: Rewriting url with htaccess when a directory exists I am doing a simple rewrite but it is not working (apparently) due to directory access permissions. The Code: *Dynamic Page: url.com/index.php?page=download Rewrite Rule: ^download$ /index.php?page=download The problem: A directory named "download" exists. When the rewrite rule tries rewrite the

using htaccess to remove .php from URL

眉间皱痕 提交于 2019-12-11 02:05:49
问题 MY URL: http://localhost/test.php I am using: .htaccess: RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.+)$ index.php?url=$1 [QSA,L] PHP: $url = $_GET['url']; echo var_dump($url); But all I get for $url is:NULL NULL NULL NULL NULL NULL 回答1: Edit: adjusted to handle both the redirect and the rewrite. RewriteEngine On RewriteBase / # Redirect .php URLs to rewritten URLs RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.+)\

IIS 7 URL Rewriting

♀尐吖头ヾ 提交于 2019-12-11 01:53:34
问题 I have been working this one for a few hours now trying get this to work. I have a CodeIgniter website that use to be on an Apache server running fine. I was using the Apache URL Rewriter for the URL in order to hide the index.php. For some reason I cannot get this to work on IIS. I have Googled it and came up with several different options but some either didn't work or redirected me to my root directory. I am trying to rewrite the URL like so http://domain.com/v2.3.1/index.php/test Below is

Apache URL Rewriting,

梦想与她 提交于 2019-12-11 01:46:20
问题 I am trying to get URL rewriting to work on my website. Here is the contents of my .htaccess: RewriteEngine On RewriteRule ^blog/?$ index.php?page=blog [L] RewriteRule ^about/?$ index.php?page=about [L] RewriteRule ^portfolio/?$ index.php?page=portfolio [L] #RewriteRule ^.*$ index.php?page=blog [L] Now the 3 uncommented rewrite rules work perfectly, if I try http://www.mysite.com/blog/, I get redirected to http://www.mysite.com/index.php?page=blog, the same for "about" and "portfolio".