.htaccess

.htaccess redirecting domain alias'

半腔热情 提交于 2020-01-21 07:35:25
问题 I have a client that has a good amount of domain alias' and wants them all redirected to the one main domain on the site. They also want to know which of the domain alias' is doing the redirecting. I have that part down but I want to optimize the code to the best most proper way it should be and to eliminate the amount of code I have to write. I am wanting to know if there is a way to pass to the RewriteRule url the domain alias that was used. This is what I have now. I am looking for the

How to preserve POST data via ajax request after a .htaccess redirect?

谁都会走 提交于 2020-01-21 07:21:07
问题 .htacesss RewriteCond %{REQUEST_URI} ^/api/(.+)$ RewriteRule ^api/(.+)$ /index.php?api=%1 [QSA,L] example ajax url request: 'http://hostname.com/api/ext/list.php?query=de' I want to be able to redirect urls in this format to the following index.php?api={requested_filename}&param1=value1&param2=value2 ... because the whole site is processed through a bootstrap process in index.php which has a routing part loading configs, templates etc... When I try a jquery code for example, the POST data is

How to remove .php extension and add slash on the url? [closed]

和自甴很熟 提交于 2020-01-21 05:40:25
问题 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 8 years ago . Here is my current .htaccess code RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^([^\.]+)$ $1.php [NC,L] it is works only in removing .php extension from http://localhost/mysite/news.php?category=cat1&id=1 to http://localhost/mysite/news/cat1/1/ and from http://localhost/mysite/news.php

Apache .htaccess hotlinking redirect

家住魔仙堡 提交于 2020-01-21 05:40:06
问题 I am trying to create a redirection when someone hotlinks images in one directory on my site. If someone hotlinks an image, I want to redirect them to a corresponding image (same file name) in a different directory. If someone hotlinks: www.mydomaoin.com/PlayImages/Basic/Embedded/{ImageName.gif} I want it to redirect to: www.mydomaoin.com/PlayImages/Basic/Shared/{ImageName.gif} Thoughts? 回答1: RewriteEngine on #redirect image hotlinks RewriteCond %{HTTP_REFERER} !^$ RewriteCond %{HTTP_REFERER}

.htaccess RewriteRule works but the URL isn't changing in the address bar?

我只是一个虾纸丫 提交于 2020-01-21 05:26:35
问题 I have been pulling my hair trying to figure this out but nothing is working. I have a webpage at mysite.com/test.php I want to do a simple URL rewrite and change it to mysite.com/testRewrite/ The code to do implement this should be: Options +FollowSymLinks RewriteEngine on RewriteRule ^testRewrite/$ test.php [NC,L] For whatever reason it's just not working. When you go to the new URL - mysite.com/testRewrite/ it works. However, if you type in the original URL mysite.com/test.php it doesn't

.htaccess RewriteRule works but the URL isn't changing in the address bar?

穿精又带淫゛_ 提交于 2020-01-21 05:26:29
问题 I have been pulling my hair trying to figure this out but nothing is working. I have a webpage at mysite.com/test.php I want to do a simple URL rewrite and change it to mysite.com/testRewrite/ The code to do implement this should be: Options +FollowSymLinks RewriteEngine on RewriteRule ^testRewrite/$ test.php [NC,L] For whatever reason it's just not working. When you go to the new URL - mysite.com/testRewrite/ it works. However, if you type in the original URL mysite.com/test.php it doesn't

How do I redirect subdomains that do not exist?

强颜欢笑 提交于 2020-01-21 05:02:24
问题 I am trying to redirect using .htaccess in the following fashion. I am not all that familiar with .htaccess, so I'm not sure it can be done. Also, I don't know if how I am intending to do it follows best practices for SEO. www.domain.com > domain.com 301 ks.domain.com > kansas.domain.com 301 ia.domain.com > iowa.domain.com 301 domain.com/sites > domain.com 301 domain.com/sites/iowa > iowa.domain.com 301 nonexistent.domain.com > domain.com 302 domain.com/sites/nonexistent > domain.com 302 My

Learning .htaccess [closed]

帅比萌擦擦* 提交于 2020-01-20 14:23:14
问题 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 . I would like learn about .htaccess file, from the very basic to the complex portions. All its capacities, with blocking user, authentication, hiding files, redirection. So far I have only used them, but I want to learn about them, understand them. So that I will be able to create my own rule. Could you please

Learning .htaccess [closed]

扶醉桌前 提交于 2020-01-20 14:22:08
问题 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 . I would like learn about .htaccess file, from the very basic to the complex portions. All its capacities, with blocking user, authentication, hiding files, redirection. So far I have only used them, but I want to learn about them, understand them. So that I will be able to create my own rule. Could you please

using htaccess password protection on rails?

扶醉桌前 提交于 2020-01-20 13:57:28
问题 I want the /admin route on my rails app to be protected by using .htaccess password files - is this possible? 回答1: Rails has a built-in helper for this, you could place this in your application controller: protected def authenticate authenticate_or_request_with_http_basic do |username, password| username == "admin" && password == "test" end end Then use a before_filter on any controllers you want to protect (or just stick it in the application controller to block the whole site): before