.htaccess

How to format URL on Website with htaccess

人盡茶涼 提交于 2020-01-07 09:21:42
问题 I would like some help in formatting a url so that it is more SEO friendly. So the url is formatted below www.portfolio.com/workDetails?url=work-title-here but I would like the format to be www.portfolio.com/work/work-title-here I've tried the following RewriteEngine on RewriteRule ^/work/([0-9]+)\.html /workDetail.php?url=$1 But I got a 500x error 回答1: This page appears to have a solution to what you are trying to do: <? $Params = explode( '/', $PATH_INFO ); while( list( $Index, $Value ) =

htaccess redirect to public and application folder

北城余情 提交于 2020-01-07 08:09:09
问题 I have this directory structure for a MVC project: / | .htaccess | index.php +---application | +---app | | +---controller | | | AppController.class.php | | +---files | | | style.css | | +---model | | \---views | | AllApps.php | | Main.php | \---login | +---controller | | LoginController.class.php | +---files | | application.js | | login.css | | background.png | +---model | | LoginModel.class.php | \---views | Login.php \---public | .htaccess | index.php +---css | bootstrap.css +---js |

why does the regex in my rewrite condition seem to not catch?

余生长醉 提交于 2020-01-07 08:07:49
问题 I have URLs like the following: mysite.com/eng?sentence=dog and I want to rewrite them as mysite.com/eng/dog so I want to replace ?sentence= with a "/" I have tried all of the following: RewriteCond %{THE_REQUEST} ^GET\ sentence= [NC] RewriteRule ^ /%1 [NC,L,NE] RewriteCond %{THE_REQUEST} ^GET\ \?sentence= [NC] RewriteRule ^ /%1 [NC,L,NE] RewriteCond %{THE_REQUEST} ^GET\ \?sentence=([^/?&\s]+) [NC] RewriteRule ^ /%1 [NC,L,NE] RewriteCond %{THE_REQUEST} ^GET\s/+\?sentence=([^/?&\s]+) [NC]

htaccess redirect with variables

帅比萌擦擦* 提交于 2020-01-07 08:02:18
问题 I realise there are similar questions but I'm trying to work out how I can rewrite the following URL: http://www.myWEBaddress.com/?month=200904 to http://www.myWEBaddress.com/my-page.php?month=200904 Regards 回答1: Add the following to the .htaccess file in the root directory of your site. RewriteEngine on RewriteBase / RewriteCond %{QUERY_STRING} (^|&)month= [NC] RewriteRule ^ my-page.php [L] If you want to change the URL that the user sees in their browser address bar, change the last rule to

use .htaccess redirection to connect to vpn

牧云@^-^@ 提交于 2020-01-07 06:58:08
问题 I am trying to connect to a VPN connection using an automatic redirection via a .htaccess redirection, so the vpn setup is a bit more user-friendly using an url instead of an ip address. The thing is that, when using the ip directly, all works smoothly. However, using .htaccess which redirects to my public IP address throws an Error 868 . My .htaccess is very basic - all I do is forward the input to the public IP without any filter: RewriteEngine on RewriteCond %{HTTPS} off RewriteRule ^(.*)$

.htaccess remove .php and force trailing slash

99封情书 提交于 2020-01-07 05:43:15
问题 I have files in my root folder. jobs.php , contact.php . I want to be able to use .htaccess to remove the .php extension and force a trailing slash / . So that, www.domain.com/jobs/ and www.domain.com/contact/ goes to their respective pages. Also, I want jobs.domain.com to point to www.domain.com/jobs/ <IfModule mod_rewrite.c> Options +SymLinksIfOwnerMatch RewriteEngine On RewriteBase / RewriteRule ^(rosquillos)/$ $1 [L,R=301,NC] RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST

.htaccess remove .php and force trailing slash

天大地大妈咪最大 提交于 2020-01-07 05:42:14
问题 I have files in my root folder. jobs.php , contact.php . I want to be able to use .htaccess to remove the .php extension and force a trailing slash / . So that, www.domain.com/jobs/ and www.domain.com/contact/ goes to their respective pages. Also, I want jobs.domain.com to point to www.domain.com/jobs/ <IfModule mod_rewrite.c> Options +SymLinksIfOwnerMatch RewriteEngine On RewriteBase / RewriteRule ^(rosquillos)/$ $1 [L,R=301,NC] RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST

IfModule doesn't appear to be working?

余生长醉 提交于 2020-01-07 05:36:06
问题 If I use this: <IfModule mod_rewrite.c> RewriteEngine On RedirectMatch 301 ^/training/(.*) /faculty/training.html </IfModule> the redirects don't occur. Same with: <IfModule mod_rewrite> ... </IfModule> However, this works as expected: RewriteEngine On RedirectMatch 301 ^/training/(.*) /faculty/training.html In other words, the redirect works fine outside of the <IfModule> block. Is there a reason why <IfModule> wouldn't detect mod_rewrite.c? 回答1: The RedirectMatch directive is part of mod

Redirect HTTP to HTTPS

拈花ヽ惹草 提交于 2020-01-07 05:29:04
问题 I currently use this code to redirect HTTP to HTTPS: RewriteCond %{HTTPS} off RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L] It's working, http://website.com gets redirected to https://website.com, however when I'm not on the website and try to go https://website.com/about or https://website.com/contact I get redirected to https://website.com/index.php I can only visit /pages when I'm already on the website. How to fix this? I tried several .htaccess scripts but none worked. Try to

Post variables not sending : php / apache / codeigniter

和自甴很熟 提交于 2020-01-07 05:27:39
问题 I got a problem with an application built in codeigniter. The $_POST variables are not working, var_dump($_POST) returns array(0) In online environment works fine, so it's localhost problem. I think its the apache conf or the .htacces conf, I'm adding the .htacces used in this project. Any help its really appreciated, thanks. <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.+)/$ $1 [L,R=301] RewriteCond %{REQUEST_URI} ^system.*