url-rewriting

How to rewrite with .htaccess

跟風遠走 提交于 2019-12-11 11:06:32
问题 I'm pretty new to .htaccess and have a question.. How would I rewrite http://example.com/forums/view.php?v=Topic%20Name&a=64 to http://example.com/forums/view/Topic-Name/64 ? as stated above, I'm new to this.. Also, how would I replace - with while keeping normal dashes? Example: Hi There-Bye! would then convert into Hi-There-Bye! Which would then convert back to Hi There-Bye! with php and .htaccess ? 回答1: The first question is pretty basic. You need an external redirect from the 'ugly' (but

Apache rewrite rule - prevent rewritten URL appearing in browser URL bar

狂风中的少年 提交于 2019-12-11 11:04:45
问题 I have a rewrite rule which is looking for a particular URI. When it matches the particular URL it rewrites it with a proper file path so the required content can be found. It then changes the protocol to HTTPS and allows the request to pass through. I have two problems; I don't want the rewritten path to appear in the users browser - i want to maintain the vanity url I do want the HTTPS protocol to appear indicating to the user that they are accessing the site over a secured conection. I

Convert path to one get variable

倖福魔咒の 提交于 2019-12-11 10:59:34
问题 How would I go about transforming this URL: http://example.com/this/is/my/path.html http://example.com/this/is/my/path.html?var=2&varr=3 to this: http://example.com?path=this/is/my/path.html http://example.com?path=this/is/my/path.html&var=2&varr=3 I've seen many tutorials on how to convert it to multiple get variables but none for the whole path that included the get variables as well. 回答1: See my edit below Try this : RewriteEngine On RewriteRule ^(.*)$ ?path=$1 [QSA] The first part of the

What is wrong with this simple rewrite rule that doesnt redirect?

此生再无相见时 提交于 2019-12-11 10:59:05
问题 Good day to everyone, I'm struggling trying to understand what is wrong with this simple rule that doesn't work. I have a website that has URLs like that: site.com/support, I now want to redirect all the URLs site.com to site.com/en, site.com/support/ to site.com/en/support/, .... After many tries and search, I came up with the 2 following rules: RewriteRule ^(?![a-z]{2}/)(.*)$ /en/$1 [R=301,L] # redirect to default language RewriteRule ^([a-z]{2})/(.*)$ /$2?lang=$1 [QSA,L] each of these

Problem with outbound rules when setting up a reverse proxy with IIS7, ARR, & URL Rewrite

风格不统一 提交于 2019-12-11 10:39:31
问题 I'm trying to set up a reverse proxy for a website roughly as outlined in this article: http://blogs.msdn.com/b/carlosag/archive/2010/04/02/setting-up-a-reverse-proxy-using-iis-url-rewrite-and-arr.aspx The problem that I'm having is that my outbound rules aren't consistently applied, and I can't find a pattern where they consistently fail either. Sometimes when I restart IIS and make a request the outbound rules successfully applied, other times not. But consistently when I refresh the page

URL characters replacement in JSP with UrlRewrite

只谈情不闲聊 提交于 2019-12-11 10:39:17
问题 I am using UrlRewrite in a JSP project over JBoss . I have configured some rules, so that stuff like: http://mysite/parameter Is read as: http://mysite/index.jsp?parameter=parameter And so on. Now, what I would like to know if there's a way to replace certain characters submitted in the URL by the users with others. Something like what Wikipedia does. When you use a space in the URL in WikiPedia, it's replaced by a "-". Is UrlRewrite the right tool for this? I also have a few filters around,

Rewrite image path with htaccess?

一个人想着一个人 提交于 2019-12-11 10:29:58
问题 I have these old site and it has the image url in all of its .htm files like this below, <img border="0" src="images/logo.jpg" alt="xxx" width="170" height="150"> I want to know if I can add an absolute path before all the image URLs with htaccess. For instance, <img border="0" src="http://localhost/mysite/local/applications/bin/oldsite/images/logo.jpg" alt="xxx" width="170" height="150"> Is it possible? Or do I have to change the image path manually file by file? My attempt, RewriteRule ^(.*

How to hide a subfolder in url rewriting

流过昼夜 提交于 2019-12-11 10:16:29
问题 My site is : www.mysite.com/subfolder/login/index.php I want the URL there to just be www.mysite.com/login/index.php . I tried modifying the .htaccess file in the root folder as follows: RewriteRule ^login\/index\.php$ /subfolder/login/index.php [L] --but the problem is that then it can't use or access the CSS file (style.css) from the login folder. 回答1: # fix js/images/css RewriteRule ^.+?/((img|css|js)/.+)$ /subfolder/login/$1 [L,NC] Try adding this as your first rule in htaccess . Or you

.htaccess and rewrites Rules

匆匆过客 提交于 2019-12-11 10:08:19
问题 I have some difficulties to create a simply htaccess for url rewriting. What I would like is url with 3 parameters : www.example.com => index.php www.example.com/module/ => index.php?module=$1 www.example.com/module/action/ => index.php?module=$1&action=$2 www.example.com/module/action/1 => index.php?module=$1&action=$2&params=$3 I did that with many tutorials, but when I try with the last one, it's failed RewriteRule ^web/([^/]*)$ index.php?module=$1 [L,QSA] RewriteRule ^web/([^/]*)/(.*[^/])

URL rewrite : internal server error

北慕城南 提交于 2019-12-11 09:49:21
问题 I have a little problem on Apache's rewrite rules Here's my rules Options +FollowSymLinks RewriteEngine On RewriteBase / RewriteRule query/(.*) /php/query.php?name=$1 [L] RewriteRule page/(.*) /php/page.php?page=$1 [L] It works perfectly. But when I try to add the following rule to rewrite URL that not matches the two previous rules RewriteRule .* /php/page.php?page=home The server responds "Internal server error". Why ? 回答1: You can use RewriteLog to see what happends, but even with a [L]