.htaccess remove pattern from url - .htaccess

is there any way to remove some pattern from url?
For exampple this is my pattern -=-something_dynamic-=-
and here is my url
_http://mysite.com/category/-=-something_dynamic-=-subcategory/
that I wish to become
_http://mysite.com/category/subcategory/

Enable mod_rewrite and .htaccess through httpd.conf and then put this code in your .htaccess under DOCUMENT_ROOT directory:
Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /
RewriteRule ^(category)/.*?(subcategory)/?$ /$1/$2/ [L,NC,NE,R=301]

Related

.htaccess url aliasing for /r/var to #/r/var

I've tried going through the documentation for this but I'm definitely no sys admin. I'd like to create a ReWrite rule for my domain alienstream.com, so that alienstream.com/r/electronicmusic is aliased to alienstream.com/#r/electronicmusic
I know what the general form is going to follow
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^/([a-zA-Z0-9]+)$ /#/?var=$1 [L]
</IfModule>
but I just don't understand the syntax for this
Enable mod_rewrite and .htaccess through httpd.conf and then put this code in your .htaccess under DOCUMENT_ROOT directory:
Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteRule ^(r/.+?)/?$ /?sub=$1 [NC,L,R]

htaccess redirect to another folder

I have to redirect using htaccess.Please help me.
From this
URL :- http://xxx/CCKCHT/
to redirect it
URL :- http://xxx/CCKCHT/lhc_web/index.php/site_admin/
Enable mod_rewrite and .htaccess through httpd.conf and then put this code in your .htaccess under DOCUMENT_ROOT directory:
Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /CCKCHT/
RewriteRule (?!^lhc_web/index\.php/site_admin/)^(.*)$ /CCKCHT/lhc_web/index.php/site_admin/$1 [L,R=301,NC]

.htaccess Remove one of GET values and redirect

url: http://www.side.com/en/page-1/
I need to redirect to http://www.side.com/page-1/
How to do this using .htaccess file, maybe call php file and parse string( URI )?
You can do that with a simple rule:
RewriteEngine On
RewriteRule ^.*?/(.*)$ /$1 [L,R=301]
Enable mod_rewrite and .htaccess through httpd.conf and then put this code in your .htaccess under DOCUMENT_ROOT directory:
Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /
RewriteRule ^en/(.*)$ /$1 [L,R=301,NC]

url rewriting in php using .htaccess

I need to rewrite the url in my project.
I have a url like this
http://www.example.com/apps?platform=Android&category=Business&keyword=cows
and i need to rewrite this to http://www.example.com/apps/Android-Business-cows
How can i implement this url rewrite
I am cakephp framework in php.
Enable mod_rewrite and .htaccess through httpd.conf and then put this code in your .htaccess under DOCUMENT_ROOT directory:
Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /
RewriteRule ^(apps)/([^-]+)-([^-]+)-([^-]+)/?$ $1?platform=$2&category=$3&keyword=$4 [QSA,L,NC]
This will do (asuming you're using mod-rewrite on apache):
RewriteEngine ON
Options +FollowSymLinks -Multiviews
RewriteRule ^apps/([^-]+)-([^-]+)-([^-]+)$ apps?platform=$1&category=$2&keyword=$3

rewrite url using htacess.

In this point i have this structure. /quote-submit-php/ what i'd like to do is to rename the last '-' into '.' so it's going to be like this quote-submit.php
basically a single character. Thanks
Enable mod_rewrite and .htaccess through httpd.conf and then put this code in your .htaccess under DOCUMENT_ROOT directory:
Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /
RewriteRule ^(.*)-(php)$ $1.$2 [L]

Resources