.htaccess

.htaccess RewriteRule not working, need to generate a URL friendly

若如初见. 提交于 2019-12-31 03:55:07
问题 I have this dynamic link: http://www.nortedigital.mx/article.php?id=36175&t=dobla_las_manos_el_snte__avala_reforma_educativa and I need to convert in URL friendly like this: http://www.nortedigital.mx/36174/se_enriquecio_elba_en_sexenios_del_pan.html and i have this RewriteRule: RewriteRule ^([^/]*)/([^/]*)\.html$ /article.php?id=$1&t=$2 [L] but doesn't work. Please, anybody can help me? 回答1: You must capture the query string in a RewriteCond and use that in the RewriteRule RewriteEngine On

.htaccess domain redirect

别说谁变了你拦得住时间么 提交于 2019-12-31 03:55:05
问题 I have a server which has 3 domains all pointing to it. All domains are on the same website. www.domain1.com www.domain2.com www.domain3.com How can I redirect www.domain3.com to www.domain3.com/test.html using .htaccess? Thanks! 回答1: In your .htaccess, put: RewriteEngine On RewriteCond %{http_host} ^www\.domain3\.com [NC] RewriteRule ^(.*)$ http://www.domain3.com/test.html [R=301,NC] That should do it. 回答2: In your domain3 's .htaccess, put: RedirectPermanent / http://www.domain2.com/test

Redirect subfolder to root and hide it in the url

点点圈 提交于 2019-12-31 03:49:05
问题 I have managed to "rebase" the root from a directory in order to keep public files separated from configs, helpers, and controllers, thanks to this answer and this answer. However I realized that if a user type http://domain.com/public it will not redirect to http://domain.com this is harmful for SEO because robots will treat them as two urls thus duplicate. I need to 301 redirect /public to root but as long as I am trying. It doesn't work. My htaccess looks like the following: # Options

iPad/iPhone browser sniffer with mod_rewrite and redirection; “too many redirections”

吃可爱长大的小学妹 提交于 2019-12-31 03:04:08
问题 I'm trying to create a browser sniffer for Mobile Safari version, the problem is that the redirection creates an infinite loop, obviously, and I'm wondering if there's a way to do this: http://mydomain.com (or any other requets_uri) [301]-> http://mydomain.com/ipad Here's the snippet I'm using: RewriteCond %{REQUEST_URI} !^ipad #Trying to set the condition "if /ipad is not the request_uri, but it doesn't work RewriteCond %{HTTP_USER_AGENT} .*Mobile.*Safari RewriteRule ^(.*)$ ipad [R=301,L]

htaccess 301 redirection for the bots

做~自己de王妃 提交于 2019-12-31 02:59:05
问题 I need help in .httaccess rewrite rule. One of my client says "A website abc.com should send traffic (with 301 redirect) from google, bing and yahoo search engigne bots only to cba.com otherwise show index.html (its a white page) i.e if Google robot is crawling abc.com it should see a redirect to bcd.com instead of the real content". is this possible like this? RewriteEngine On RewriteCond %{HTTP_USER_AGENT} Googlebot [OR] RewriteCond %{HTTP_USER_AGENT} msnbot [OR] RewriteCond %{HTTP_USER

.htaccess change a path to a query strings

时光毁灭记忆、已成空白 提交于 2019-12-31 02:52:06
问题 I have files in example.com/ contact.php recent.php videos.php watch.php example.com/page/ > /page/ is not a folder. but i want to work other folders contact.php (no pagination) example.com/page/contact recent.php ( pagination > recent.php?page=2 ) example.com/page/recent example.com/page/recent?page=2 watch.php ( no pagination > watch.php?title=drama-name ) example.com/page/watch/drama-name videos.php ( pagination with get name > videos.php?name=drama-name&page=2 ) example.com/page/videos

conditional DirectoryIndex in .htaccess

旧时模样 提交于 2019-12-31 02:42:08
问题 Is it possible to make the DirectoryIndex value in a .htaccess file conditional based on IP, so that - for example - my IP see's DirectoryIndex as index.html and everyone else sees DirectoryIndex as index.php? Is there a solution other than mod_rewrite ? 回答1: As far as I know, there is no conditional for DirectoryIndex. You could simulate that with a mod_rewrite directive like this one: RewriteCond %{REMOTE_ADDR} your_ip RewriteCond -d RewriteRule (.*)/$ $1/index.html If you want to exclude

Set up CakePHP in a subdirectory; Wordpress is installed in the root

断了今生、忘了曾经 提交于 2019-12-31 02:30:09
问题 I have been searching for a solution for 2 hours but nothing seems to work... here is my problem: I have WordPress installed in the root (var/www). So by going to http://www.geekderek.com, I see my wordpress site. I put CakePHP in a subdirectory var/www/cakephp. I want to be able to see my CakePHP app by going to: www.geekderek.com/cakephp. However, currently this url just returns a Wordpress page saying "Content not found." I believe this problem can be solved by modifying .htaccess in my

how to redirect to a subfolder and then rewrite subfolder link to root in htaccess?

扶醉桌前 提交于 2019-12-31 02:24:17
问题 I am sorry if this question is a duplicate but everything I looked for online confused me a lot so I am posting again this question specifying my needs. Since I want the structure of my website to be clean, I want to separate content from configurations, so I am putting all pages in the /app folder (much like a rails app). The structure of the website would be pretty much like this: . ├── app │ ├── index.php │ └── products │ └── index.php ├── configs └── layouts I found out how to redirect

htaccess how to redirect all pages, but not the root directory

你。 提交于 2019-12-31 01:28:06
问题 i need a help witch an htaccess 301 redirect. I have a site www.site.com but i need to change all pages to www.newsite.com but i want not move www.site.com (for a pages information) EXAMPLE: www.site.com (not move) index of to put then a template or message www.site.com/2012/08/page.html move to www.newsite.com/2012/08/page.html www.site.com/tag/keyword/ move to www.newsite.com/tag/keyword/ www.site.com/category/general/ move to www.newite.com/category/general/ how i can do that? Thanks 回答1: