I currently have a vbulletin forums that I coppied the theme of to another site to make an application.
with this at the top of the files:
<base href="http://example.com/forums/"/><!--[if IE]></base><![endif]-->
So I simply copied/pasted the source code then modified the body.
The problem here is I have a "submit.php" button and what it does it goes based upon the base url so it becomes http://example.com/forums/submit.php but I want it to do this instead:
http://application.example.com/submit.php
If I change the BASEURL from the source code the theme won't work anymore and I'm trying to preserve the theme
If you use apache with mod_rewrite, you can create the .htaccess file in the root directory
RewriteEngine on
# Don't apply to URLs that go to existing files or folders.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Only apply to URLs that aren't already under folder forums.
RewriteCond %{REQUEST_URI} !^/forums/
# Rewrite all those to insert /forums.
RewriteRule ^(.*)$ /forums/$1
Documentation
http://httpd.apache.org/docs/2.0/misc/rewriteguide.html
Related
I have a problem for rewrite this url:
http://example.org/public/item.php?id=4
i id like to rewrite with htaccess file in:
http://example.org/public/item/4.php
this is my htaccess file:
Options +FollowSymLinks
RewriteEngine On
RewriteBase /public
RedirectMatch ^/$ /public/
RewriteRule ^public/item/([^/]*)\.php$ /public/item.php?id=$1 [L]
that works only if i digit manually the previous url, but i lost all the style css, javascript file, and images, also i want to do this redirect seo url automatically.
what I'm doing wrong?
You have to add a condition if the requested filename(javascript, css, image, etc. files) actually exist not to rewrite the url,
So all you have to do is to add a condition before your rewrite rule:
RewriteCond %{REQUEST_FILENAME} -f
check here the Documentation
I am looking for a way to write a mod_rewrite in order to insert a directory into an URL? I want to redirect old URLs to new URLs like so:
old URL: http://www.domain.com/viewtopic.php?f=1&t=128468
new URL: http://www.domain.com/forum/viewtopic.php?f=1&t=128468
I would like this to work for all values of 'f' and 't'. Thanks!
This works:
<IfModule mod_rewrite.c>
RewriteCond %{REQUEST_URI} !/forum/
RewriteCond %{REQUEST_URI} /viewtopic
RewriteRule ^viewtopic\.php$ /forum/viewtopic\.php [L,R=301]
</IfModule>
The first line checks that /forum/ is NOT already present in the URI.
The second line checks that /viewtopic is present in the URI.
the third line replaces viewtopic.php with /forum/viewtopic.php
Can you please help me this?
i have classified site: 99clix.in/latest/ , Actually it is under construction. it creates dynamic dynamics urls, i want to convert into seo friendly urls.
Eg:
DYnamic Url: http://www.99clix.in/latest/index.php?welcome/category/Mobile-Phones/Mobile-phones
Static Url:
http://www.99clix.in/latest/Mobile-Phones/Mobile-phones.
Same way i need to create for all categories and subcategory as per user search.
can you help me out for this?
Write below code in .htaccess file in your root directory, this will allow you allow you to access url without index.php
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
Please provide little more detail about your application so we can provide more personalized solution -- are you using any framework etc..
I have a mvc project and when i try type like this in the url localhost/index the url parameter in $_GET is saying it is empty when i var_dump BUT when i type like "main" it recognize it and var_dump returns main as a string.
my .htaccess file is like:
RewriteEngine On
#Options +FollowSymLinks +MultiViews -Indexes // not sure if i need any of these, seems no affect, tried to enable and disable.
RewriteBase /project_website/
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]
It just gets mad at me when i try access the Index class. If my main page were Main, Home, plaplapla whatever it works. But not with index or Index. Why word index is not OK?
I'm having trouble redirecting my main website www.mydomain.com to the folder mydomain.com/stuff/public_html/index.html while retaining www.mydomain.com in the URL. I'd prefer to use HTA over some html solution, but what's the most SE friendly and modern solution for this?
I've tried the simple HTA 301 redirect below, but it shows the file path which I want to avoid.
RewriteEngine on
RewriteCond %{HTTP_HOST} ^mydomain\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.mydomain\.com$
RewriteRule ^/?$ "http\:\/\/www\.mydomain\.com\/stuff\/public_html\/" [R=301,L]
Thanks!
Looks like you do not need an external redirect. You need an internal redirect. For this you need to remove the [R] flag in your rule (and have only [L]). The [R] flag forces an external redirect with a HTTP 301 response code.