mod-rewrite

SEO Friendly URL to Dynamic Arabic Category URL using PHP

空扰寡人 提交于 2020-01-03 03:11:08
问题 Currently I have a url like this domain/index.php?cat=مال_وأعمال I want to set things up so that our Marketing people can publish url's like domain/مال_وأعمال I've tried several solutions including: mod_rewrite - the problem with this approach is that it becomes a huge .htaccess file since we need to write a rule for each category. RewriteMap - this came pretty close since I could query the database to build map file for output. However, I've since learned we don't have access to httpd.conf.

.htaccess remove trailing slash after file extension

心不动则不痛 提交于 2020-01-03 03:05:12
问题 I have some external links to my site that referrer to pages with a file extension and a trailing slash after that e.g. http://example.com/folder/page.php/ I can not change these links, but I would like to 301 redirect those links to this format instead: http://example.com/folder/page/ I've tried this, but it doesn't work: RewriteRule ^(.*)\.php\/$ /$1/ [R=301,L] Any help is appreciated. 回答1: Try this in your /.htaccess file RewriteEngine On RewriteCond %{THE_REQUEST} /([^.]+)\.php/? [NC]

.htaccess Rewrite Within Directory - Hide PHP extension and force trailing slash

回眸只為那壹抹淺笑 提交于 2020-01-03 02:56:08
问题 I'm trying to hide the .php extension from my files as well as force a trailing slash on the resulting URLs. Example: A request to /about.php would become /about/ and requests to /about would go to /about/. The following rewrite code worked perfectly when I was in the root of my hostdomain: RewriteEngine On RewriteRule ^(.*)/$ /$1.php [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_URI} !(.*)/$ RewriteRule ^(.*)$ http://edit.mydomain.org/$1/ [R=301,L] RewriteCond %{THE_REQUEST}

How to change change URL format to POST using htacess php?

ε祈祈猫儿з 提交于 2020-01-03 02:47:08
问题 I have htaccess tha handle redirections know i want to hit api like i have a url like that http://localhost:8080/test/network/country/category/subcategory/fixedvalue I have fixed value like detail, category ,codes but only in case of detail i need id as parameter example http://localhost:8080/test/Airtel/UK/Prepaid/5G/Detail below is redirect url that i want to generate from htacess file if fixed value is detail http://localhost:8080/h1.php?network=Airtel&country=UK&category=Prepaid

.htaccess rule: multiple domains to one ssl domain

烈酒焚心 提交于 2020-01-03 00:56:10
问题 I've tried around getting the following to work for 2 hours now. I have multiple domains such as: Test.Xy.zz Test.Abc.de Test.mmm.mm Now only Test.xy.zz got an ssl certificate and the application running on it is limited to it. Therfor I want all non-ssl requests - including test.xy.zz and all other domains to go to https://test.xy.zz Hope someone can help. Possible solution: RewriteEngine On RewriteCond %{HTTP_HOST} !test\.xy\.zz RewriteRule ^(.*) https://test.xy.zz/$1 [QSA,R=301]

apache rewrite: force https and name of server, not IP

走远了吗. 提交于 2020-01-02 22:02:51
问题 I want my apache to always force people to use https and to map IP based look ups to be forwarded to the server name. The following settings (in httpd.conf file) take care of the http to https redirect: <Location /> Options +FollowSymLinks RewriteEngine On RewriteCond %{HTTPS} off RewriteRule (.*) https://my_server.example.com%{REQUEST_URI} </Location> But now I also want that if people type 192.168.1.2 they get redirected to my_server.example.com. To sum up: http://192.168.1.2/someurl ->

.htaccess url rewrite and removing %20 [duplicate]

时间秒杀一切 提交于 2020-01-02 21:48:32
问题 This question already has an answer here : htaccess rewrite replace space with - (1 answer) Closed 5 years ago . Hi Im very new at the rewriting thing. I have an Apache host that is hosting my website and I need to make the url rewrite to make it just look better than it currently is. So I have this link http://www.kalah.co.za/content.php?page=Civil%20Tactical%20Training and i want it to look like http://www.kalah.co.za/Civil-Tactical-Training.html Now I can do the first bit I guess with this

Simple mod rewrite query string but still failed

旧时模样 提交于 2020-01-02 19:23:22
问题 I want to create .htaccess mod rewrite but still have problem. Suppose i created friendly URL like this : mydomain.com/mypage/12345/title-of-news I want that friendly URL process the below URL in hidden process : mydomain.com/index.php?p=mypage&idnews=12345 Values of "p" and "idnews" are dynamic, so they will have different value. I tried below code but still didn't work. Anything wrong? RewriteBase / RewriteCond %{QUERY_STRING} p=(\w+)&idnews=(\d+) RewriteRule ^index.php /%1/%2 [L,R=301] Any

htaccess get filename without path

六月ゝ 毕业季﹏ 提交于 2020-01-02 19:21:07
问题 I'm trying to get the requested filename without the path with htaccess for a RewriteCond. REQUEST_FILENAME returns the full absolute path, but I only need the filename like test.php I've been searching for this a lot but couldn't find anything that helped me out. Thanks for any responses in advance! Edit: Im trying to do something like this: RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond _%{REQUEST_FILENAME}.php -f RewriteRule ^([^/]*)$ _$1.php [L] The

.htaccess - how to remove repeated words in url?

淺唱寂寞╮ 提交于 2020-01-02 14:13:05
问题 What is the regex in .htaccess to go from those urls: example.com/hello-world-world example.com/hello-world-hello to this one: example.com/hello-world using RewriteCond like this: RewriteCond %{REQUEST_METHOD} !=POST RewriteCond %{REQUEST_URI} ^REGEX$ RewriteRule . %1 [R=301,L] 回答1: Removing all the duplicate words from slug is pretty tricky to be done in mod_rewrite only but here is a lookahead based regex rule than you can use: RewriteEngine On RewriteCond %{REQUEST_URI} ^/((?:[^-]*-)*)([^-