url-rewriting

How can I create a dynamic URL in php?

偶尔善良 提交于 2019-12-04 21:50:50
I am new in PHP and MySQL. Here's what I've tried so far and I can't understand how to make URL with PHP. What I want to do is to create a dynamic web page about a particular book. I already created and have some data in my MySQL database to play with. I've got a function to clear the special characters in the book titles. function seo($s) { $tr = array('ş','Ş','ı','İ','ğ','Ğ','ü','Ü','ö','Ö','Ç','ç'); $eng = array('s','s','i','i','g','g','u','u','o','o','c','c'); $s = str_replace($tr,$eng,$s); $s = strtolower($s); $s = preg_replace('/&.+?;/', '', $s); $s = preg_replace('/[^%a-z0-9 _-]/', '',

Set language using htaccess URLrewrite

那年仲夏 提交于 2019-12-04 21:39:17
问题 I have for example two files in my root directory: one.php and two.php . I would like to reach them through these urls without having to actually have the physical directories en+de. mydomain.com/en/ one mydomain.com/en/ two mydomain.com/de/ one mydomain.com/de/ two So the first directory would be "ignored" and just pass a GET variable with the language setting to the php-file, second directory is the php-file without extension. This is what I'm using in my htaccess to loose the file

http to https redirect - iis8.5 url rewrite 2.0 redirect rule not working

爷,独闯天下 提交于 2019-12-04 21:13:34
I am having a hard time getting the below redirect rule to work... <rules> <rule name="Relative Path Rewrite" stopProcessing="false"> <match url=".*" /> <conditions logicalGrouping="MatchAll"> <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /> <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /> <add input="{REQUEST_URI}" pattern="^/$" negate="true" /> </conditions> <action type="Rewrite" url="/" /> </rule> <rule name="Ssl Redirect" stopProcessing="false"> <match url="(.*)" /> <conditions> <add input="{HTTPS}" pattern="^OFF$" /> </conditions> <action type=

Proxy_pass ignoring port

守給你的承諾、 提交于 2019-12-04 20:53:31
I have a CentOS server running NGINX listening to 80 and a DB servering an app on 8080. I want to be able to Type http://example.com/dev/abc and have it actually access http://example.com:8080/apex/abc or http://localhost:8080/apex/abc I have used this location configuration location /dev { proxy_pass http://example.com:8080/apex; } However when I try it out the url displayed is http://example.com/apex/apex the page is not found and the log says: 2018/06/14 12:51:33 [error] 7209#0: *2067 open() "/usr/share/nginx/html/apex/apex" failed (2: No such file or directory), client: 124.157.113.187,

Why does htaccess RewriteRule ^foo$ also match ^foobar$

折月煮酒 提交于 2019-12-04 20:53:05
I want these URL redirects / forwards: here.com/foo ==> there.com/a/b here.com/foobar ==> there.com/c/d I have these two .htaccess RewriteRule lines: RewriteRule ^foo$ http://there.com/a/b [R=301,L] RewriteRule ^foobar$ http://there.com/c/d [R=301,L] But the result is: here.com/foo ==> there.com/a/b here.com/foobar ==> there.com/a/b foo is also matching foobar How do I make it work? This was a browser caching issue. I initially had the rules wrong. I changed the rules to those listed above, but because I'm using HTTP status code 301 (Moved Permanently), the browser was caching it and not

Rewrite condition is not working

时光总嘲笑我的痴心妄想 提交于 2019-12-04 20:32:23
How to rewrite the URL for my search page in opencart that is like http://IP/opencart/index.php?route=product/search&filter_name=24 But I need to display it like http://localhost/opencart/product/search/42 orelse in any formate that is an userfreindly.I have tried like RewriteEngine On RewriteBase /opencart RewriteRule ^sitemap.xml$ index.php?route=feed/google_sitemap [L] RewriteRule ^googlebase.xml$ index.php?route=feed/google_base [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} !.*\.(ico|gif|jpg|jpeg|png|js|css) RewriteRule ^([^?]*)

Lighttpd configuration, . (dots) in my query string cause 404

半城伤御伤魂 提交于 2019-12-04 20:14:01
I have an address on my site like so: http://www.example.com/lookup?q=http%3A%2F%2Fgigaom.com%2F2010%2F10%2F10%2Fangry-birds-for-windows7-phone-dont-count-on-it%2F In this example, the dot in the 'gigaom.com' part of the query string is screwing with lighttpd and my rewrite rules. I get a 404 with the dot in, no 404 if I take the dot out. My rewrite rules are below. In case it makes a difference, I'm using symfony 1.4. If anyone could shed some light on this problem it would be much appreciated! url.rewrite-once = ( "^/(.*\..+)$" => "$0", "^/(.*)\.(.*)" => "/index.php", "^/([^.]+)$" => "/index

Simple URL Rewrite on IIS

随声附和 提交于 2019-12-04 19:52:12
I have 1 IIS server that I would like to use to host 2 different web sites (both on port 80). I've been trying many different combinations (including redirects) and every time, something was breaking (redirect loops, 404, simply not working, etc...) The rule I think I need goes something like this: - match any URL - condition 1: match {HTTP_HOST} to my site URL - condition 2: discard if {REQUEST_URI} is present - action: rewrite URL to /dir1/index.html (repeat for site 2) The problem here seems to be that condition 2 is never true (what should I use to match the absence of {REQUEST_URI} ? Here

Url redirection subdirectory to subdomain

一个人想着一个人 提交于 2019-12-04 19:49:44
I am using php. and i want to redirect subdirectory to subdomain and subdirectory of subdirectory to subdomain directory. For example : if i have url like http://www.test.com/test1/ then it should be redirect to http://test1.test.com/ and second if i have url like this http://www.test.com/test1/test2/ then it should be redirect to http://test1.test.com/test2/ Any one have idea how to do this. Thanks in advance can do in .htaccess with something like.. RewriteEngine On RewriteRule ^([^/]+)/(.*)$ http://$1.test.com/$2 [R,L] 来源: https://stackoverflow.com/questions/5013357/url-redirection

IIS Url Rewrite Module causes “unable to start debugging on the webserver”

删除回忆录丶 提交于 2019-12-04 19:43:17
问题 I have just implemented URL Rewrite Module 2.0 for IIS 7 and it seems to be causing a "unable to start debugging on the webserver" error in Visual Studio 2010. Aside from commenting the node in the web.config, does anyone know if there might be a fix for this for VS2010? Thanks 回答1: See the solution of Kirk Woll here: Unable to start debugging on the web server. Could not start ASP.NET debugging VS 2010, II7, Win 7 x64 Just add this rule at the top of your rules <rule name="Ignore Default