mod-rewrite

How to make a tumblr style profile url

大兔子大兔子 提交于 2020-01-23 07:20:49
问题 I wonder, how does tumblr doing profile url like this: http://www.username.tumblr.com/ http://username.tumblr.com/ I know we can change the profile url http://www.website.com/profile.php?user=username to http://www.website.com/username using the following RewriteRule RewriteRule ^([^/]+)/?$ profile.php?user=$1 [L,QSA,NC] I don't know how tumblr doing those profile urls. How can we make user profile urls like this: http://www.username.website.com/ http://username.website.com/ I have a

301 redirect in StackOverflow. How does it works? [closed]

痞子三分冷 提交于 2020-01-23 03:15:17
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . Let's take, for instance, the url of this question http://stackoverflow.com/questions/20306229/301-redirect-in-stackoverflow-how-does-it-works If i change something in the final part of the URL, making it like http://stackoverflow.com/questions/20306229/301-r I get a 301 message and i'm redirected EXACTLY to the

RewriteRule with an IPv6 IP address does not work

一笑奈何 提交于 2020-01-23 02:51:28
问题 I am having problems to proxy requestions inside a IPv6 address. On .htaccess/apache2.conf, I have it: RewriteRule (.*) http://18.4.15.8:80/path/$1 [P,L] It works fine, because it is a IPv4 address. But, it does not works: RewriteRule (.*) http://[27:ec:20:22:15::d3]:80/path/$1 [P,L] Why? Error Log: Proxy Error Your browser sent a request that this server could not understand. The proxy server could not handle the request GET /index.html. Reason: URI cannot be parsed: http://%5b27:ec:20:22:15

PHP URL Format without .php extension?

纵饮孤独 提交于 2020-01-23 02:14:26
问题 all I need is to get a string as URL without showing the PHP filename. I have file contact.php page I am trying to get URL as e.g. localhost/contact.php this is what now I am getting I need to access this page just with localhost/contact For every page I should able to navigate by their name only. localhost/contact localhost/help localhost/support 回答1: You need to use an .htaccess file if you are using apache. If you are using IIS then you can configure it in IIS. Have a look at this. Your

Apache .htaccess to redirect index.html to root, why FollowSymlinks and RewriteBase?

 ̄綄美尐妖づ 提交于 2020-01-22 15:19:05
问题 In order to redirect all somefolder/index.html (and also somefolder/index.htm ) to somefolder/ I use this simple rewrite rule in Apache .htaccess file: RewriteEngine on RewriteCond %{THE_REQUEST} ^.*\/index\.html?\ HTTP/ RewriteRule ^(.*)index\.html?$ "/$1" [R=301,L] This works well! But at Google groups they suggest to add also: Options +FollowSymlinks RewriteBase / Could anyone be so kind to explain me why would i have to add these last lines, and explain me a bit what they mean and what

Ridirecting to a site when there is a ?(question mark) in the URL?

那年仲夏 提交于 2020-01-22 03:34:08
问题 I need an htaccess which redirects if there is a ?(question mark) in the URL, Some sample URL's, mysite.com/?p=44 mysite.com/?m=44 mysite.com/?cat=44 mysite.com/index.php?cat=44 The question mark could be anywhere after the "/". It should work for with the "www" and without it as well. If there is a question mark, it should go to newsite.com. Since I'm new to htaccess I don't know how to go about it and new some help from you'll. Thanks. 回答1: You can try this rule RewriteEngine On RewriteCond

Rewrite URL in PHP with mod_rewrite

社会主义新天地 提交于 2020-01-22 03:33:05
问题 The web server is Apache. I want to rewrite URL so a user won't know the actual directory. For example: The original URL: http://www.example.com/en/piecework/piecework.php?piecework_id=11 Expected URL: http://piecework.example.com/en/11 How to achieve it with mod_rewrite? 回答1: You need to define a rewrite rule (should be similar to this): RewriteRule ^/(.*)/en/piecework/(.*)piecework_id=([0-9]+)(.*) piecework.mydomainname.com/en/$3 and put it in a .htaccess file under the main folder of you

Codeigniter | OVH | htaccess / url rewriting | Site very slow

落花浮王杯 提交于 2020-01-22 02:10:10
问题 Here is my htaccess for removing the index.php with codeigniter : RewriteEngine On RewriteCond $1 !^(index\.php|assets|robots\.txt) RewriteRule ^(.*)$ index.php/$1 [L] But with this .htaccess, there is an error "File not found." So, I'm searching, and here is a little solution : http://forum.ovh.com/showthread.php?93572-Codeigniter-et-htaccess Adding a "?" resolve the problem, but the site is sometimes very very slow, and sometimes very fast ! And sometimes, my style sheets don't load (assets

How to change URL? htaccess

一个人想着一个人 提交于 2020-01-21 21:49:11
问题 What I have newsy/czytaj/items/odbierz-250zl-na-reklame.html This is what I would have newsy/odbierz-250zl-na-reklame.html How to do this with mod-rewrite ? I don't understand RewriteRule. My .htaccess RewriteEngine On RewriteCond %{REQUEST_URI} (ftp|https?):|/etc/ [NC,OR] RewriteCond %{QUERY_STRING} (ftp|https?):|/etc/ [NC] RewriteRule .* - [F,L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule .*\.html$ index.php [L] 回答1: RewriteEngine on RewriteRule

Apache .htaccess to hide both .php and .html extentions

谁说胖子不能爱 提交于 2020-01-21 15:19:05
问题 What lines should I add to remove both .html and .php extensions from my site? I use this for just the .html part: RewriteEngine on RewriteBase / RewriteCond %{http://jobler.ro/} !(\.[^./]+)$ RewriteCond %{REQUEST_fileNAME} !-d RewriteCond %{REQUEST_fileNAME} !-f RewriteRule (.*) /$1.html [L] RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^.]+)\.html\ HTTP RewriteRule ^([^.]+)\.html$ http://jobler.ro/$1 [R=301,L] but I need for both file type extensions to be hidden from the same domain. 回答1: I