.htaccess

Rewriting url to hide index.php and to make query nice

橙三吉。 提交于 2020-01-17 01:11:17
问题 I had developed project with custom MVC architecture. And I am new to Apache world, so I would appreciate help with this matter. On a Web I had found lots of tutorials, but no one like mine interests. I have URL like this: http://knjiskicrv.comoj.com/index.php?page=book&id=1 I would like to be display like this: http://knjiskicrv.comoj.com/book/id/1 Or this: http://knjiskicrv.comoj.com/index.php?page=faq Into this: http://knjiskicrv.comoj.com/faq If there is no page in query (http:/

small problem with .htaccess file?

主宰稳场 提交于 2020-01-17 00:26:14
问题 i have a small .htaccess file which allow me to run 1 html file as php <Files yourpage.html> AddType application/x-httpd-php .html </Files> i need to edit this script so it run all .html and .htm files as .php and i need this to apply for the files not only yourpage.html i tried to do it like that AddType application/x-httpd-php5 .php .html but it doesn't make any sense i though to remove yourpage.html and put *.html but i don't if its the right way or not 回答1: Use: AddType application/x

301 redirect in htaccess

拟墨画扇 提交于 2020-01-16 19:25:09
问题 I changed the URL of my articles so I need to be able to redirect them all, but this is how I had it set before in htaccess: RewriteRule ^industry/([a-zA-Z0-9-]+).([0-9]+)/$ index.php?tag=industry&slug=$1&id=$2 Which would give me something like: site.com/industry/blah-blah.6842/ Now with my new site, I have the URLs set like this: site.com/blah-blah/ So how I can do a 301 redirect in htaccess? I can't do all the articles individually because there's tons of them. I need to be able to

.htaccess redirect query string value to another key

人走茶凉 提交于 2020-01-16 14:17:10
问题 What i'm trying to do is rewrite the following pattern http://example.org/path?articleid=5657 to this pattern: http://example.org/path?p=5657 Essentially it comes down to changing the key to the url parameter, i have searched extensively with no clear example of how to do this exact thing using only htaccess rewrite rules. i've tried this general approach with no luck RewriteCond %{QUERY_STRING} ^articleid=([0-9]*)$ RewriteRule ^articleid=([0-9]*)$ /?p=$1 [R=301,L] 回答1: You can't match

301 redirect URL with variable

邮差的信 提交于 2020-01-16 12:02:28
问题 I want to use htaccess to 301 redirect (not rewrite) urls like: brands.php?brand=Sony to brands/Sony How can i do that? Appreciate your help in advance. 回答1: So your users are entering brands.php?brand=Sony into their browser, and being redirected? If I have that correct, it's simple: RewriteEngine On RewriteCond %{QUERY_STRING} brand=([^&]+) [NC] RewriteRule brands\.php brands/%1 [L,R=301] 来源: https://stackoverflow.com/questions/7796421/301-redirect-url-with-variable

301 redirect URL with variable

早过忘川 提交于 2020-01-16 12:01:49
问题 I want to use htaccess to 301 redirect (not rewrite) urls like: brands.php?brand=Sony to brands/Sony How can i do that? Appreciate your help in advance. 回答1: So your users are entering brands.php?brand=Sony into their browser, and being redirected? If I have that correct, it's simple: RewriteEngine On RewriteCond %{QUERY_STRING} brand=([^&]+) [NC] RewriteRule brands\.php brands/%1 [L,R=301] 来源: https://stackoverflow.com/questions/7796421/301-redirect-url-with-variable

htaccess editing ( rewrite links to another type )

我怕爱的太早我们不能终老 提交于 2020-01-16 09:38:20
问题 I've a file sharing script, When I upload a file, the download link of the file is showing as this : http://www.example.net/file?id=fileID Noting that the ( file?id=fileID ) is given by a functions php file .. while the original shape of links : download.php?id=fileID. Now when I browse the link http://www.example.net/file?id=fileID ... I get Not found .. and the htaccess has the following : RewriteRule ^file([0-9]*)?id=$ download.php?id=$1 and it still not found.. So I want to Rewrite the

URL redirect using .htaccess

纵然是瞬间 提交于 2020-01-16 09:36:13
问题 I have changed my normal™ php website to CodeIgniter framework. My issue is I need to: redirect http://samajam.org/contact_us.php to http://samajam.org/contact 回答1: Try Redirect 301 /contact_us.php http://samajam.org/contact Enjoy, i hope i helped you :) 回答2: You can set 301 redirection in your .htaccess file like - Redirect 301 http://samajam.org/contact_us.php http://samajam.org/contact OR you can use CodeIgniter URL Helper for redirection 来源: https://stackoverflow.com/questions/49505791

URL redirect using .htaccess

青春壹個敷衍的年華 提交于 2020-01-16 09:36:07
问题 I have changed my normal™ php website to CodeIgniter framework. My issue is I need to: redirect http://samajam.org/contact_us.php to http://samajam.org/contact 回答1: Try Redirect 301 /contact_us.php http://samajam.org/contact Enjoy, i hope i helped you :) 回答2: You can set 301 redirection in your .htaccess file like - Redirect 301 http://samajam.org/contact_us.php http://samajam.org/contact OR you can use CodeIgniter URL Helper for redirection 来源: https://stackoverflow.com/questions/49505791

.htaccess 500 error. RewriteRule not working as it should

天大地大妈咪最大 提交于 2020-01-16 08:47:09
问题 I have a problem with one of my .htaccess rewriterule: Server details: Server runs LiteSpeed Webserver not Apache, according to my host provider it's 100% compatible with apache mod_rewrite. Problem: I get 500 Internal Server Error when i use this code: <IfModule mod_rewrite.c> Options +FollowSymLinks Options +Indexes RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} !^www\.mysite\.com$ [NC] RewriteCond %{HTTP_HOST} ^(www.)?([a-z0-9-]+).mysite.com$ [NC] RewriteRule ^(.*)$ %2/$1 [L,QSA