think the user enter
localhost/app/public/anything/anything/index/php/id/5
then id like to change it to the
localhost/app/public/index.php?id=5
the expression that i wrote is this
RewriteRule ^index/php/id/([0-9]+)$ http://localhost/saecms/public/index.php?id=$1 [L]
but it doesn't work, whats wrong here? thank you
You can use this rule in your /app/public/.htaccess file:
RewriteEngine On
RewriteBase /app/public/
RewriteRule (?:^|/)index.php/id/(\d+)/?$ index.php?id=$1 [L,QSA,NC]
Related
My .htaccess file as below,
DirectoryIndex routing.php
RewriteEngine on
RewriteBase /
RewriteCond %{THE_REQUEST} \s/+Milan_Practice/Milan_Mvc/routing\.php[\s?] [NC]
RewriteRule ^ Milan_Practice/Milan_Mvc/ [L,R=302]
RewriteRule ^Milan_Mvc/?$ Milan_Mvc/routing.php [L,NC]
By Appling above code I got url like below,
http://localhost/Milan_Practice/Milan_Mvc/?name=about
in above,there after "?",data is not in valid format as I want like this,
http://localhost/Milan_Practice/Milan_Mvc/about/
So please give your suggestion with proper ReWriting Rule for above code
ThankYou in Advance !!!
RewriteRule ^([a-z]{2,2})/([a-zA-Z0-9_-]+)$ index.php?name=$1 [QSA]
See http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html
I have this following url localhost/test/index.php?page=1 And i want it to be
'index.php/page/1'
so far I have this :
RewriteEngine On
RewriteRule ^page/([0-9]+)/?$ index.php?page=$1 [NC,L]
But it's not working .Any suggestion what am i doing wrong ?
Try with this
RewriteRule ^page/([^/]*)$ index.php/?page=$1 [L]
If you set it correct then URL like this http://localhost/test/page/1 should work
Try this one
RewriteEngine on
RewriteRule ^(.*)/page/([0-9]+)$ /index.php?page=$2 [NC,L]
The url will be
localhost/test/index.php/page/123
If you want the url looks like
localhost/test/index.php/page/123/
change you rule into this one
RewriteEngine on
RewriteRule ^(.*)/page/([0-9]+)/$ /index.php?page=$2 [NC,L]
RewriteRule ^index.php\/page\/(.*?)\/?$ index.php?page=$1 [NC]
The above code should solve your probleem. But you may want to read up on mod_url_rewrite
See https://www.sitepoint.com/guide-url-rewriting for more info
I have a .htaccess which reads as follows
Options +FollowSymlinks
RewriteEngine On
RewriteBase /
RewriteRule ^([a-z0-9\-]+) /index.php?page_name=$1 [L]
I want the link
http://www.solublesilicates.com/our-services when clicked should read as http://www.solublesilicates.com/?page_name=our-services.
Please do help.
RewriteRule ^([a-z0-9\-]+)$ /index.php?page_name=$1 [L, QSA]
Just change it to the above. Should work perfectly.
You have error in your syntax. Your regex should end with $ sign
RewriteRule ^([a-z0-9\-]+)$ /index.php?page_name=$1 [L]
Change the Rewrite Rule to
RewriteRule ^([A-Za-z0-9\-]+) index.php?page_name=$1 [L,QSA]
I am trying to redirect www.mysite.com/movie/name to www.mysite.com/movie/?url=name
for this I have added htaccess in movie/ folder, the code I have added is below:
RewriteEngine On
RewriteBase /movie/
RewriteEngine On
RewriteRule ^([a-zA-Z0-9_-]+).html$ index.php?id=$1
RewriteRule ^([a-zA-Z0-9_-]+)/$ index.php?id=$1
I am unable to redirect it, could anybody suggest me the right way to accomplish this?
Just a small change and it should work..
Try below code and let me know whether it worked for you or not..
RewriteEngine On
RewriteRule ^([a-zA-Z0-9-/]+).html$ index.php?id=$1
RewriteRule ^([a-zA-Z0-9-/]+).html/$ index.php?id=$1
Hope it helps...
First off, you only need to write command RewriteEngine On once.
Besides, replace last rule for
RewriteRule ^([a-zA-Z0-9_-]+)$ index.php?id=$1
The fault was in the last backslash.
I want to rewrite this url
http://localhost/vector-svn/demo.php
rewrite to
http://localhost/vector-svn/demo
my .htaccess file code
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^(.*)\.$ $1.php [nc]
any kind help would be appreciated ?
Answer to my own question !!
This works for url rewriting !!
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php
You could do this:
rewriteRule ^(.*)$ $1.php [NC]
Edit: I see your rewrite rule is exactly the same. What problem do you have?
Sounds like mod_rewrite is not installed at all. Check apache documentation, link.
Sorry, brief answer... this link might also help you out, could be a few things and as mentioned the rewrite looks fine, so try and see if any of the following work.
http://www.wallpaperama.com/forums/how-to-fix-mod-rewrite-500-internal-server-error-on-htaccess-file-apache-t718.html